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:
@Stateonly works with structs.
@ObservedObjectto work with classes.
@Publishedlets us announce property changes to any SwiftUI views that are watching.
onDelete(perform:)to enable swipe to delete.
EditButtonto navigation bar items, to let users edit list data more easily.
Codable, including working with data stored in a hierarchy.
Identifiableprotocol to make sure all items can be identified uniquely in our user interface.
GeometryReaderto make content fit the screen.
ScrollViewto lay out custom views in a scrollable area.
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.
CGAffineTransformto create rotations and translations.
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, and that’s OK.
SPONSORED With Sentry’s error and performance monitoring for iOS you see mobile vitals that actually matter, can solve any latency issues quickly, and learn how each release is performing over time.
Link copied to your pasteboard.