Remember last used trending category and country

This commit is contained in:
Arkadiusz Fal
2021-09-27 00:19:50 +02:00
parent c4674c06a4
commit 994f1f9215
5 changed files with 14 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ import SwiftUI
struct TrendingCountry: View {
static let prompt = "Country Name or Code"
@Binding var selectedCountry: Country?
@Binding var selectedCountry: Country
@StateObject private var store = Store(Country.allCases)
@@ -87,9 +87,7 @@ struct TrendingCountry: View {
}
func selectCountryAndDismiss(_ country: Country? = nil) {
let selected = country ?? selection
if selected != nil {
if let selected = country ?? selection {
selectedCountry = selected
}