-
var description: String { ... }
can be used to define what the variable is going to show when printed. Struct needs to also function like CustomStringConvertible
to this work
24:16
struct FilterFlights: View {
@Binding var flightSearch: FlightSearch
@Binding var isPresented: Bool
// applies filters only when leaving the sheet
@State private var draft: FlightSearch
init(flightSearch: Binding<FlightSearch>, isPresented: Binding<Bool>) {
_flightSearch = flightSearch
_isPresented = isPresented
_draft = State(wrappedValue: flightSearch.wrappedValue)
}
...
-
Picker(...)
takes 3 parameters: label, selection (binding to the thing where selected value is saved), and the views (you provide a bunch of views to choose from
- Add
.tag(...)
to the view that's clicked because this line will then update second argument to be what value is inside tag
- Looks much better when
Picker
is put inside Form
-
Form
needs to be inside NavigationView
to make it clickable
@RealLankinen
Originally published here
Top comments (0)