Your First iOS & SwiftUI App: An App from Scratch

Feb 13 2023 Swift 5.7, iOS 16, Xcode 14

Part 1: Getting Started with SwiftUI

2. SwiftUI vs UIKit

Episode complete

Play next episode

About this episode
See versions
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 1. Introduction Next episode: 3. Challenge: Make a Programming To-Do List

The order of the courses in the beginning learning path mentioned has changed; see the current order here

There’s a saying erroneously attributed to the Chinese: “May you live in interesting times.”

Depending on your point of view, that can be either a blessing or a curse. And right now, this saying accurately describes the situation that beginner iOS developers find themselves in today.

In 2019 Apple introduced SwiftUI, which is the fancy new way to create user interfaces in Swift.

One of the cool things about SwiftUI is that your user interfaces are created completely in code, but while you’re coding you can see a dynamic preview of this code in SwiftUI’s canvas editor. And you have a choice - you can either code the user interface yourself, or you can use Swift UI’s canvas editor to code it on your behalf.

This is nice because SwiftUI gives you the benefits of being able to construct a user interface via code, combined with the benefits of being able to visualize your work as you go. It also makes working with SwiftUI really nice in real-world, team-based environment.

Apple has been promoting SwiftUI as the preferred way to build new apps for many reasons, including the fact that it makes it easier to port your iOS apps to Apple’s other platforms, such as macOS, watchOS and tvOS.

Plus, it’s plain fun! As you’ll see for yourself in this course, creating beautiful user interfaces with SwiftUI is a pure joy.

It’s important to know that SwiftUI isn’t the only way of making user interfaces on iOS. You can also use something called UIKit, which is the framework that iOS developers had to use before SwiftUI was released.

I want to point out that UIKit is still a valid way to make iOS apps. In fact, I’d say there are still probably more developers using UIKit than SwiftUI.

If SwiftUI is so great, why is that?

Well, there are three main reasons.

First - SwiftUI only works on iOS 13 or later. Even though iOS 16 is out now, some companies need to support earlier version of iOS and are just getting to a place where they can start switching to SwiftUI.

Second - SwiftUI is still not as mature as UIKit. Think about it: UIKit has been out for 12 years, and in fact it was based on a macOS framework called AppKit which had even more history, so there was a lot of time to get things right.

But SwiftUI is much younger. This means there are still some missing features and a rough edges. Some companies still want to give SwiftUI a little more time to catch up, or they’ll have to use some UIKit to account for missing features.

Third and finally - many companies have already written their apps using UIKit. It can be a ton of work to rewrite an entire app in SwiftUI! So, a lot of that old UIKit legacy code will remain for quite some time.

So now it comes time to answer your burning question…

…which should I learn: SwiftUI or UIKit?

As of today, here’s our answer.

It’s both!

If you’re serious about being a professional iOS developer, our recommendation is to learn both SwiftUI and UIKit.

Learning SwiftUI is important because it’s the future of iOS development. SwiftUI is huge, and there’s a lot to learn, so it’s a good idea to get started now. And if you’re making a new app, you can make it with SwiftUI today.

Learning UIKit is important too. If you end up working at a company that already has shipped an iOS app, there’s a high chance that it’s using UIKit. So if you want to work at one of those companies, it’s important for you to be able to work with those codebases too.

I also want to point out that it’s not all or nothing: it’s possible to make a certain part of your app with SwiftUI, and the rest with UIKit. As companies begin to transition from UIKit to SwiftUI, we expect to see many codebases with a mixture of both SwiftUI and UIKit code in the years ahead.

This is first course in our “iOS and SwiftUI for Beginners” learning path, and we’re taking a SwiftUI-first approach here because SwiftUI is the future of iOS development.

This way can be sure that you’re learning the latest and greatest techniques, making your skills future-proof and in high demand.

If you follow along with this course, and then continue on through the rest of the courses as recommended by “iOS and SwiftUI for Beginners” learning path, you’ll get a solid start developing iOS app and you’ll build up your programming skills in Swift.

Once you’re done with this learning path, there’s still more to do! You can move onto more advanced learning paths, like iOS User Interfaces with SwiftUI, iOS Data and Networking, and iOS IDEs and Tools. Where you go next depends on what you want or need to learn. There’s no wrong choice.

All of these use SwiftUI. But what about UIKit? As we mentioned, it’s important to learn that too.

That’s why we created a special and optional learning path, called iOS User Interfaces with UIKit. If you need to learn UIKit development for your job or to add UIKit-only features to you app, you should definitely check that out.

So for new iOS developers having to learn two ways of creating user interfaces at once, these are definitely some interesting times.

But hey - learning new things is part of the joy of being a programmer. We’re loving learning SwiftUI and are so excited to be on the cutting edge of the future, and we hope you enjoy this journey with us!