mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +00:00
35 lines
964 B
Swift
35 lines
964 B
Swift
import SwiftUI
|
|
|
|
struct TrendingCountrySelectionView: View {
|
|
@Environment(\.presentationMode) private var presentationMode
|
|
@ObservedObject var provider: TrendingCountriesProvider
|
|
|
|
@State private var query: String = ""
|
|
@Binding var selectedCountry: Country
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
VisualEffectView(effect: UIBlurEffect(style: .dark))
|
|
|
|
ScrollView(.vertical) {
|
|
ForEach(countries) { country in
|
|
Button(country.name) {
|
|
selectedCountry = country
|
|
presentationMode.wrappedValue.dismiss()
|
|
}
|
|
}
|
|
.frame(width: 800)
|
|
}
|
|
.searchable(text: $query)
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.edgesIgnoringSafeArea(.all)
|
|
}
|
|
|
|
var countries: [Country] {
|
|
provider.load(query)
|
|
|
|
return provider.countries
|
|
}
|
|
}
|