Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show searchbar on load #2

Open
skunkworker opened this issue Dec 19, 2020 · 4 comments
Open

How to show searchbar on load #2

skunkworker opened this issue Dec 19, 2020 · 4 comments

Comments

@skunkworker
Copy link

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

@aksonov
Copy link

aksonov commented Dec 23, 2020

I'm interested too

@FUNKYJASPER2
Copy link

is there any update on a solution?

@Geri-Borbas
Copy link
Owner

Geri-Borbas commented Mar 12, 2021

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

@Y-Rov
Copy link

Y-Rov commented Mar 9, 2023

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants