Last active
June 9, 2021 18:08
-
-
Save iosdevie/1fe241f002929bafb34fa115575ca4b0 to your computer and use it in GitHub Desktop.
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 characters
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