Implement trending view actions across platforms

This commit is contained in:
Arkadiusz Fal
2021-08-01 00:10:56 +02:00
parent 3a780b3d2c
commit 64ff1afa70
9 changed files with 231 additions and 371 deletions

View File

@@ -1,27 +0,0 @@
import SwiftUI
struct TrendingCountrySelectionView: View {
@State private var query: String = ""
@ObservedObject private var store = Store<[Country]>()
@Binding var selectedCountry: Country
@Environment(\.dismiss) private var dismiss
var body: some View {
ScrollView(.vertical) {
ForEach(store.collection) { country in
Button(country.name) {
selectedCountry = country
dismiss()
}
}
.frame(width: 800)
}
.searchable(text: $query, prompt: Text("Country name or two letter code"))
.onChange(of: query) { newQuery in
store.replace(Country.search(newQuery))
}
.background(.thinMaterial)
}
}