This is another huge year of updates, delivering many highly requested features such as advanced scroll view effects, container relative sizing, and even Metal shaders.
SwiftUI continues to evolve at a rapid pace, and this year has seen a huge number of improvements to scroll views, fun new SF Symbols effects, advanced support for Metal shaders, and more.
Some of these are things I’ve asked for personally, including the ability to add Metal shaders, making Color
work better with Codable
, adding a completion closure for animations, allowing us to animate gradients, and being able to selectively round corners of a rectangle – I’ve closed at least a dozen feedbacks just from beta 1!
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure and A/B test your entire paywall UI without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You might expect me to talk about SwiftData here, but I’m not – or at least not yet. Yes, it’s important, and yes it’s genuinely a huge step forward for all iOS developers, but I’m spending a lot of time writing test projects, experimenting, and getting answers to my questions, because I want to be really sure I understand it thoroughly before I write about it.
However, there are other interesting SwiftUI changes to discuss:
onChange()
modifier now accepts 0 or 2 parameters, and can also be triggered by your initial valueforegroundColor()
modifier has been formally deprecated in favor of foregroundStyle()
..bouncy
and .snappy
, and springs are now created with much simpler API. .rect
, .capsule
, and so on.ForEach(users)
rather than ForEach(users, content: TableRow.init)
And although it’s more of an Xcode improvement than a SwiftUI improvement, all images and colors defined in assets catalogs now have static names we can use in code rather than strings: Image(.dog)
rather than Image("dog")
, for example.
There are also new APIs for performing keyframe animations, new map controls, and more – I’m still digging in, writing code samples, and finding techniques that work well.
I particularly like some of the approaches taken in these new APIs, particularly the way things like scroll bar flashing, sensory feedback, and phase animations can be triggered using a simple Equatable
comparison – it really lowers the complexity bar
The dramatic and wide-ranging changes to data management in SwiftUI are really welcome. In fact, there’s a video of me actually letting out a scream during Apple’s State of the Union session at Apple Park – I’m really glad to see it arrive.
However, it’s also something that takes care to get right. I’ll be updating my books for it – of course! – but I also want to make sure I understand the best practices for using it thoughtfully, so I hope you don’t mind a little delay while I’m conducting all my research.
Thank you for your patience!
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure and A/B test your entire paywall UI without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
Link copied to your pasteboard.