Moving towards SwiftUI from UIKit: A SwiftUI Primer

Written by Sam
2 min read
Coding on

Apple introduced SwiftUI at WWDC in 2019 as a framework for creating declarative UI. Since then, it’s undergone nearly four years of revision and refinement. Although, unlike the Swift language itself, has lacked any kind of mechanisms for true community feedback and development. Despite this, it appears that Apple has, according to @timacfr, increasingly been dogfooding SwiftUI in apps like Weather and Shortcuts on iOS and in various system components and apps on macOS. macOS Ventura appears to have about 12% of its code written in SwiftUI, versus only 2% three years ago. That’s a very significant change, and very fast for an operating system that’s been around since PowerPC was the hot new thing.

And if the writing wasn’t already on the wall, Apple has, well, written it on the wall:

Apple WWDC 2022 State of The Platforms
Apple WWDC 2022 State of The Platforms

The official line during the WWDC 2022 State of The Platforms presentation was that “If you’re new to our platforms, or if you’re starting a brand new app, the best way to build an app is with Swift and SwiftUI.” That’s pretty remarkable. And it’s the clearest indicator (maybe ever) from Apple about what technologies to use and where their platforms are headed.

“If you’re new to our platforms, or if you’re starting a brand new app, the best way to build an app is with Swift and SwiftUI.”

So, if you haven’t started with SwiftUI, there’s no better time than now. But don’t head into your SwiftUI journey expecting it to work like UIKit. To move from UIKit to SwiftUI, you’ll need to shift your development thought process and leave behind a lot of UIKit muscle-memory.


I originally wrote this for my company’s blog. Continue reading the full article here.