Mobile App Development 2022W Lecture 4
Video
Video from the lecture given on January 21, 2022 is now available:
Video is also available through Brightspace (Resources->Zoom Meetings (Recordings, etc.)->Cloud Recordings tab). Note that here you'll also see chat messages.
Notes
Lecture 4 --------- Remember that in swift, references by default always have a value - they won't have "nil" But sometimes operations won't return a valid value - i.e., looking something up in a dictionary, getting user input So swift forces us to handle the case of it being nil before it allows us to use the data The idea of optional types and unwrapping optional types is all about changing runtime errors (oops, the value is nil when it should have been something valid) into a compile time error. Notice in Swift we don't normally deal with "exceptions" - errors are handled where they are generated generally Any view can have @State variables We use @Binding to share variables between views - one declares it with @State - the other references it using @Binding - The declaring one must then include the @Binding one, connecting the variables as part of the inclusion.