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:
@State
only works with structs.@ObservedObject
to work with classes.@Published
lets us announce property changes to any SwiftUI views that are watching.sheet()
modifier and presentationMode
.onDelete(perform:)
to enable swipe to delete.EditButton
to navigation bar items, to let users edit list data more easily.UserDefaults
.Codable
, including working with data stored in a hierarchy.Identifiable
protocol to make sure all items can be identified uniquely in our user interface.GeometryReader
to make content fit the screen.ScrollView
to lay out custom views in a scrollable area.NavigationLink
.first(where:)
method to find the first element in an array that matches a predicate.layoutPriority()
to adjust how much space is allocated to a view.InsettableShape
.CGAffineTransform
to create rotations and translations.ImagePaint
.drawingGroup()
.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!
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.
Sponsor Hacking with Swift and reach the world's largest Swift community!
Link copied to your pasteboard.