Skip to content

Instantly share code, notes, and snippets.

@iosdevie
Last active June 9, 2021 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iosdevie/1fe241f002929bafb34fa115575ca4b0 to your computer and use it in GitHub Desktop.
Save iosdevie/1fe241f002929bafb34fa115575ca4b0 to your computer and use it in GitHub Desktop.
struct Colors : Identifiable{
var id = UUID()
var name : String
}
struct SearchingLists: View {
@State private var searchQuery: String = ""
@State private var colors: [Colors] = [Colors(name: "Blue"),Colors(name: "Red"),Colors(name: "Green")]
var body: some View {
NavigationView {
List($colors) { $color in
Text(color.name)
}
.searchable("Search color", text: $searchQuery, placement: .automatic){
Text("re").searchCompletion("red")
Text("b")
}
.navigationTitle("Colors List")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment