Created
February 3, 2020 20:45
-
-
Save artur-ios-dev/5bd32381de3e170298976d392a0d8d86 to your computer and use it in GitHub Desktop.
Revisions
-
artur-ios-dev created this gist
Feb 3, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ struct SearchView: View { let array = "SwiftUI is great but some views might need an extra work".components(separatedBy: " ") @State private var searchText = "" var body: some View { VStack { SearchBar(text: $searchText) List { ForEach(array.filter{$0.hasPrefix(searchText) || searchText == ""}, id:\.self) { searchText in Text(searchText) } } .gesture(DragGesture().onChanged { _ in UIApplication.shared.endEditing(true) }) } } }