FREE TRIAL: Accelerate your app development career with Hacking with Swift+! >>

DAY 37

Project 7, part 2


Today you’re going to build a complete app using @ObservedObject, @Published, 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:

  • @Published publishes change announcements automatically.
  • @ObservedObject watches for those announcements and refreshes any views using the object.
  • 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 learn about @ObservedObject, sheet(), onDelete(), and more.

That’s another app built, and lots more techniques used in context too – great job!

Need help? Tweet me @twostraws!

 

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for iOS devs who want to become complete senior developers — from October 18th to 24th. Learn how to apply iOS app architecture patterns through a series of lectures and practical coding sessions.

Learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

100 Days of SwiftUI


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.

Back to 100 Days of SwiftUI

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.