Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Lankinen
Lankinen

Posted on

     

CS193p Notes - Lecture 11: Picker

  • var description: String { ... } can be used to define what the variable is going to show when printed. Struct needs to also function likeCustomStringConvertible to this work

24:16

structFilterFlights:View{@BindingvarflightSearch:FlightSearch@BindingvarisPresented:Bool// applies filters only when leaving the sheet@Stateprivatevardraft:FlightSearchinit(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 whenPicker is put insideForm
      • Form needs to be insideNavigationView to make it clickable

@RealLankinen

Originally published here

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Not ready...
  • Location
    Earth
  • Joined

More fromLankinen

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp