Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Minor hw4 tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
JHawk0224 committed Mar 26, 2024
1 parent 6f5d7f4 commit bbfed5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/homework/hw4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Once you've made the structs above, you'll want to create an array of locations

These will also need to be saved to the device, so you will need to make appropriate modifications so that each of these are saved when updated in the view model. This depends on what you decide to use for each one.

Useful tip: If you are using UserDefaults and have an @AppStorage property wrapper inside some ObservableObject, this automatically makes the variable also act as @Published.
Useful tip: If you are using UserDefaults and have an `@AppStorage` property wrapper inside some ObservableObject, this automatically makes the variable also act as `@Published`.

Now use `@StateObject` in your main view to create an instance of this view model for your app. Then, use the `.environmentObject` modifier to pass it to all other views, much like we did in [lecture 5](https://github.com/cis1951/lec5-code).

Expand Down

0 comments on commit bbfed5f

Please sign in to comment.