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

02. SwiftUI vs UIKit

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 01. Introduction Next episode: 03. Challenge: Make a Programming To-Do List

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 02. SwiftUI vs UIKit

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

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

There's a saying erroneously attributed to the Chinese: "May you live in interesting times." Depending on your point of view, that can either be 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 SwiftUI'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 environments. 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 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 that 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 versions 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 Mac OS 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 is still some missing features and 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? And 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 wanna work at one of those companies, it's important for you to be able to work with those code bases too. I also wanna point out that it's not all or nothing. It's possible to make a certain part of your Apple SwiftUI and the rest with UIKit. As companies begin to transition from UIKit to SwiftUI, we expect to see many code bases with a mixture of both SwiftUI and UIKit code in the years ahead. This is the 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 you 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, you'll get a solid start developing an 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 on to more advanced learning paths, like iOS user interfaces with SwiftUI, iOS data and networking, and iOS IDs and tools. Where you go next depends on what you want or need to learn, and there's no wrong choice. All of these use SwiftUI, but what about UIKit? As we mentioned, it's important to learn that too and that's why we created a special and optional learning path that's called iOS User Interfaces with UIKit. If you need to learn UIKit development for your job or to add UIKit only features to your 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, and we are 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.