WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

What you learned

Hopefully you felt like these projects started to stretch you a little, not only in pushing your SwiftUI skills further but also teaching you some more advanced Swift. Plus, of course, you also have two new SwiftUI projects that you built – you can go ahead and keep customizing these all you want, put them on GitHub, or perhaps convert them into something else that better suits your tastes.

Here’s a quick recap of all the new things we covered in the last three projects:

  • Why @State only works with structs.
  • How to use @ObservedObject to work with classes.
  • How @Published lets us announce property changes to any SwiftUI views that are watching.
  • Presenting and dismissing views using the sheet() modifier and presentationMode.
  • Using onDelete(perform:) to enable swipe to delete.
  • Adding EditButton to navigation bar items, to let users edit list data more easily.
  • Reading and writing data with UserDefaults.
  • Archiving and unarchiving data with Codable, including working with data stored in a hierarchy.
  • Using the Identifiable protocol to make sure all items can be identified uniquely in our user interface.
  • How to use GeometryReader to make content fit the screen.
  • Using ScrollView to lay out custom views in a scrollable area.
  • Pushing new views onto the navigation stack using NavigationLink.
  • Using Swift’s generics system to write methods that work with different kinds of data.
  • How to use Swift’s first(where:) method to find the first element in an array that matches a predicate.
  • Using layoutPriority() to adjust how much space is allocated to a view.
  • Creating custom paths and shapes.
  • Creating shapes that can be inset and have their border stroked, using InsettableShape.
  • Using CGAffineTransform to create rotations and translations.
  • Making creative borders and fills using ImagePaint.
  • Enabling Metal for drawing complex views using drawingGroup().
  • Modifying blend modes and saturation.
  • Animating shapes with animatableData and AnimatablePair.

I hope you’ll agree that’s a lot, and it also spans a wide range – we’ve gone from hard-core language features through to user-facing views, and even further on to creative uses for Swift’s drawing system. Some folks will prefer the pure language stuff and others will prefer the more creative side of coding, and that’s OK – we all learn differently!

Hacking with Swift is sponsored by RevenueCat

SPONSORED You know StoreKit, but you don’t want to do StoreKit. RevenueCat makes it easy to deploy, manage, and analyze in-app subscriptions on iOS and Android so you can focus on building your app.

Explore the docs

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

Buy Pro Swift Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift (Vapor Edition) Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Server-Side Swift (Kitura Edition) Buy Beyond Code

Was this page useful? Let us know!

Average rating: 5.0/5

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.