Loving SwiftUI, missing UIKit” from the title, and I did. Especially the concluding paragraph:
Here’s where I’m landing. It’s not that I want to go back to the old way — I don’t. I like writing less code. What I’m saying is that both systems have a lot of value, but that treating the SwiftUI approach as inherently better is wrong. Neither approach is better or worse, they’re different. I will probably continue to pine for the other whenever I work in one for the rest of my career.
All progress comes with a cost. After the Swift announcement, I wondered what the cost of the new language to iOS and other Apple platform development would be. I thought I even wrote about it in the newsletter, but my search skills are lacking if I did! However, even with a great transition plan between the languages that continues to this day¹, it set back app development progress by years. Did we eventually move forward with Swift? Almost everyone would say yes. What was the cost? Huge.
Similarly, the transition from UIKit to SwiftUI has been ongoing for over five years, and like it or not, this has had a huge effect on productivity. Even just the choice to experiment with a new framework adds significant time to projects. In those early years, I heard so many horror stories of disastrous and stressful projects caused by the brave (or foolish?) few who adopted it in 2019. 😬 Is it a step forward? Certainly, creating cross-platform² apps is much easier, and it’s quicker to develop most of an application, but the cost over the past five years? Again, huge.
Where would Objective-C be now without Swift? Where would UIKit and AppKit be without SwiftUI? We’ll never know. I think Apple made the correct decision in developing both Swift and SwiftUI. There were good reasons to do so, but it doesn’t mean the other choices were necessarily poor.
The good news is that both major transitions, and even things like Swift concurrency, swift-testing, and countless other projects is that they’ve all been opt-in. Apple forced no one to move on from Objective-C, abandon UIKit, or switch to Swift 6 language mode. We don’t know if those “old” technologies will disappear permanently at some point, and as developers, we’re inclined to always want to adopt the latest technology. That, along with a constant fear of becoming irrelevant in an increasingly competitive job market can cause us to feel a unnecessary sense of urgency to move on.
So, to refer back to Collin’s original point: Is SwiftUI inherently better than UIKit? Not necessarily, but especially in an ecosystem with a large tech company creating the language and frameworks, I’d always encourage a gentle move towards their new technologies over a rushed one.
Dave Verwer
¹ I see you, Objective-C developers! ❤️
² In this case, the definition of cross-platform means “across Apple platforms”.
See how AI models stack up at generating code fixes for iOS and Android crashes. Instabug benchmarks the leading models from OpenAI, Google, Anthropic, and Meta to reveal surprising platform-specific strengths and which models deliver the most accurate solutions for your debugging arsenal.
I’ve linked to Kishikawa Katsumi’s Swift Regex project before, but it gets another mention this week as he added a regex debugger to it! I’m not sure I’ve ever seen a debugger in a regex tool before, but after experiencing how useful this feature is, I don’t want to work on a complex regex without it!
As Donny Wals says, no matter how hard you try to avoid it, you’ll sometimes need a shared instance of a class that you need in a handful of places throughout your app, and:
In Swift 6, this will lead to issues because Swift 6 doesn’t like non-Sendable types, and it also doesn’t like global mutable state.
This is a well-written, step-by-step look at all the different issues making this situation compatible with Swift 6 language mode. 👍
Next, how about a pair of complementary articles? First, Vera Dias’s article linked in the title covering the basics of @MainActor
. Once you’re done with that, move on to Ege Sucu’s article, “Swift Actors: What Are They For?”, with the tagline “No, I’m not talking about @MainActor
! The perfect combination. 👍
Yes, this article from Alex Harri Jónsson is about WebGL, not Metal or anything Apple platform specific, but it’s a truly worthwhile read. If any of you convert it to Metal and run it in a SwiftUI view, let me know! While we’re on the subject, you should also check out Benjamin Pisano’s latest post on a similar, but using Metal!
I missed these videos from the wonderful iOS Conf SG conference that took place a few months ago. However, there are some fantastic talks here, so I’m making up for missing it by linking to them now! 🇸🇬
Is this even real life? 🙄