Skip to content

How to show searchbar on load #2

Open

Description

@skunkworker

Hi, thanks for making this clean example of adding a searchbar. I've been looking but unable to find a way to show the SearchBar by default without having to pull down on the view. Is there a simple way to change this?
Thanks

Activity

  1. aksonov commented on Dec 23, 2020

    @aksonov

    I'm interested too

  2. FUNKYJASPER2 commented on Mar 10, 2021

    @FUNKYJASPER2

    is there any update on a solution?

  3. Geri-Borbas commented on Mar 12, 2021

    @Geri-Borbas
    Owner

    Please take a look at these other branches below as well, as in some cases there is a search bar visible when the view opens.

    Prototype/UI/UIKit_Navigation_Stack
    Prototype/UI/UIKit_Navigation
    Prototype/UI/SwiftUI_Navigation

  4. scrooge1987 commented on Mar 9, 2023

    @scrooge1987

    @skunkworker @aksonov @FUNKYJASPER2 Hi, guys👋. If the question is still relevant, for (iOS 13.0, *) and SwiftUI add the following:

    ViewControllerResolver { viewController in 
            viewController.navigationItem.searchController = self.searchBar.searchController
            viewController.navigationController?.navigationBar.sizeToFit() // This line rocks
     }

    Original StackOverflow answer: https://stackoverflow.com/a/67721006

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions