Today you’re going to build a complete app using @Observable
, sheet()
, Codable
, UserDefaults
, and more. I realize that seems like a lot, but I want you to try to think about all the things that are happening in the background:
@Observable
watches classes for changes and refreshes any views that are affected.sheet()
watches a condition we specify and shows or hides a view automatically.Codable
can convert Swift objects into JSON and back with almost no code from us.UserDefaults
can read and write data so that we can save settings and more instantly.Yes, we need to write the code to put those things in place, but so much boilerplate code has been removed that what remains is quite remarkable. As French writer and poet Antoine de Saint-Exupery once said, “perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away.”
Today you have five topics to work through, in which you’ll put into practice everything you learned about @Observable
, sheet()
, onDelete()
, and more.
That’s another app built, and lots more techniques used in context too – great job!
Great job on finishing another day! If you still have questions about what you learned, please send them in using this form – I'll do my best to address the most common problems in the next course update. Thank you!
If you use Twitter, the button below will prepare a tweet saying you completed today, along with a celebratory graphic, the URL to this page, and the challenge hashtag. Don't worry – it won't be sent until you confirm on Twitter!
Alternatively, copy and paste the text below to your preferred social network - I'm @twostraws on Mastodon.social, Bluesky, and Threads.
🎉 I just finished Day 37 of the #100DaysOfSwiftUI at https://www.hackingwithswift.com/100/swiftui/37 via @twostraws
Need help? Tweet me @twostraws!
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until February 9th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
The 100 Days of SwiftUI is a free collection of videos, tutorials, tests, and more to help you learn SwiftUI faster. Click here to learn more, or watch the video below.
Link copied to your pasteboard.