Search CTRL + K

Thread 2, Day 13 - Friday, February 3, 2023

Agenda

  1. Finding Square Roots
  2. Share the Bill: Opportunities for Further Abstraction
  3. Share the Bill: Add a Second Tab to Show History
    • Data to be saved within an app should be created in one location only
      • Put another way, a given piece of data must have just one single source of truth
      • Currently this occurs with the @State property wrapper
      • How, though, can we share data between screens?
      • That is where the @Binding property wrapper is useful
        • In brief:
          flowchart TD
          
          id1["App Entry Point\n@State"] --> id2["Screen 1\n@Binding"]
          id1 --> id3["Screen 2\n@Binding"]
        • Let's examine this together now...
        Note

        Here is the video from this discussion in class – how to share data between screens using @Binding

  4. End-of-module Task: Make an Interactive App

To-do items

Before our next class...