Flo Writes Code
← Back to Blog

You're holding SwiftUI wrong

As with many "computer problems", the real problem is usually in front of the screen.

This year, I decided to post an April fools joke on X that hit right home for quite a few people:

I´m gonna go all in on UIKit from now on. - @FloWritesCode

The irony behind this (and the reason so many people believed it) is that there are genuinely many people deciding to switch back to UIKit lately.

And I understand it for those who used UIKit for many years before originally switching to SwiftUI. It's their framework of choice and they likely have a much deeper understanding of it compared to SwiftUI.

This matters. Especially for a paradigm-defining framework like SwiftUI, it's important to understand how it works in addition to understanding how to use it. And here's the caveat: SwiftUI is designed to be easy to use - that's the entire purpose of the framework. But it's hard to understand, since there are so many internal mechanisms disguised as PropertyWrappers and Macros.

Why people are switching back

We've had the UIKit vs. SwiftUI debate since the framework came out. Truth be told, the first few years of SwiftUI were rough - especially those things that were easy in UIKit (e.g. navigation). I totally understand if people were hesitant to fully move to SwiftUI in those years - there's a reason for engineering's oldest mantra ´never change a running system´. Luckily, Apple gave us HostingControllers and several other APIs to let the two frameworks co-exist in our codebases. But those times are now over. SwiftUI is pretty much feature complete and if it there's still a small thing it can't do you can still integrate UIKit for that little aspect.

Nowadays, there's another reason why people think about this debate again: LLMs. This one makes a lot more sense to me. Essentially, LLMs massively speed up coding. And development speed is one of the (if not the) reason to use SwiftUI in the first place. So with this bottleneck taken care of, I absolutely understand why UIKit-lovers are thinking about going back right now. If I was a big UIKit lover, I'd probably do the same. Not because one framework is better than another, but because I prefer one (due to the API design or the amount of experience I have with it).

Why SwiftUI is the still best way to build an app

Because Apple said so. They did (at WWDC 2024). And it actually matters, because they are the ones providing the tooling, making the API design decisions and maintaining both frameworks. Of course that wouldn't be worth a lot if they didn't walk the walk, but they do. Just look at liquid glass. It's essentially free if you're using (standard) SwiftUI, but requires lots of manual work if your entire codebase is made up of custom UIViews. Liquid glass (which by itself is of course quite controversial) isn't the only piece of evidence supporting Apple's claim. Look at widgets, live activities, dynamic island, and control center controls (ok, technically all of these are part of WidgetKit, but these are all modern iOS concepts you should probably support for a tight OS integration).

When watchOS first launched, apps were mostly made with WatchKit UI. Now they are made with SwiftUI. When visionOS launched, there wasn't even a VisionKit for UI. It immediately adopted SwiftUI (and technically also supports UIKit, but I doubt many apps use it).

Regarding the LLM-specific reasons: Yes, LLMs still struggle with SwiftUI. But you shouldn't use LLMs to generate SwiftUI code. You should use agentic systems like Cursor or Claude Code instead. And heck, you probably shouldn't be generating production code for a framework you don't understand in any case.

Take home message

Do whatever floats your boat! Nobody can forbid you from using a framework. Sure, many older apps still use UIKit. If that's the case for yours, you might want to continue down that road (but keep in mind that SwiftUI is preferred by Apple). For newer apps and especially if you're just learning to code, I strongly recommend SwiftUI. If you want to kickstart your SwiftUI journey, I'd recommend giving CWC+ a try (affiliate link). They have many courses for beginners and advanced developers. If you're interested in understanding SwiftUI and advanced concepts in the framework, you can check out my YouTube channel to learn more.