NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

Should you learn SwiftUI or UIKit?

Recorded – watch the full episode on YouTube.

If you were to learn today, you start learning today. Would you say I would choose SwiftUI or UIKit?

Sean Allen: I have two answers for you on this one. They're both answers here. So the old and wise Sean, that has kind of been through that before would say UIKit.

Because for many reasons, a lot of people already said UIKit is not going anywhere. Like you're not going to be able to avoid UIKit. So that's what, if I knew now what I know then Sean, would say. Young and naive, Sean, that's just starting out would say, "No, no, no, I'm doing SwiftUI a hundred percent. I want to go where Apple's going. Not where they've been.

That was the attitude I took with Swift versus Objective-C. I completely punted Objective-C, never touched it, went all in on Swift in 2015. And I was like, “okay, maybe the world will come to me". Luckily, for the most part it did. So that would be young and naive Sean.

“If I had the wisdom that I do now, if want to call it that. I would definitely learn UIKit for sure. Because again, you're not going to be able to avoid it, especially if you're trying to get a job because there's how many million apps out there that are all built pretty much in UIKit.”

But again, that's not what I would do now. If I had the wisdom that I do now, if want to call it that. I would definitely learn UIKit for sure. Because again, you're not going to be able to avoid it, especially if you're trying to get a job because there's how many million apps out there that are all built pretty much in UIKit. Like they're just not going to go away overnight.

Paul Hudson: It's certainly true that SwiftUI is the new kid on the block and however many million apps is built using UIKit or AppKit or WatchKit and similar. SwiftUI is only a tiny percentage, it must be less than 1% even today.

I think what confuses folks is they think to themselves, “I’m going to learn Swift. And that means in a month's time, I'll start building apps”, and in practice, it isn't really like that is it? If think about it, if I were to learn French, for example, or Spanish or any other language in the world, I might say, “okay, I'm going to spend the next year learning French.” So what I think folks try and think about sometimes is not just where they are today, but where they'll be at when they finished their learning journey, to a point where they can get a job. Obviously we've had one Dub Dub last year. Another Dub Dub in about a month as we talked today though we don't know weirdly still, allegedly.

Anyway, but that will bring in SwiftUI 2.0 presumably or who knows what.

If someone's learning today and they expect the finish around about November time. That seems realistic to say, “I know enough to get a good job.” Presumably at that point SwiftUI would be more adopted.

Once 14 had shipped as GM, apps now can support iOS N minus one. So iOS 13 and 14, SwiftUI can be supported everywhere. So is that the case or not?

Sean Allen: Yeah, I mean, of course it's going to grow over time. I just, I don't think it's going to be the majority, in my opinion for a couple of years. You know, you're going to see maybe it's going to be 5% of apps and then 10%. It will grow and in my opinion, it will dominate over time. Like you said, it's not going to be there next year. I don't think it's going to be to that dominant point even in two years, three years, but it will get there.

And again, first of all, nobody can predict the future, right? We're all just guessing. So that's just my viewpoint on it and what I think. And my reason being is kind of looking at a timescale a little bit, right? Because I compare it to when Objective-C and Swift came out for Objective-C. The App Store, correct me if I'm wrong, 2009, 2010, when developers could start developing for it, your Objective-C and in 2014 Swift comes out.

“And I think it'll take SwiftUI longer than Swift did to start penetrating that. But at the end of the day, I do believe it will overtake.”

So that's only like four or five years for Objective-C to build its base in apps before we started switching over to Swift. Well, now UIKit has had about a decade to build that base of millions of apps. So I think Swift overtaking Objective-C took what two, three, four years. I think SwiftUI is going to take a lot longer just because UIKit had a whole decade to build a base. And also, I think more apps were created in the latter years of that decade.

If you compare the number of apps made per year, probably in like 2012, 2013, and I'm just guessing by the way, I don't have this data, but I bet more apps were being made in 2017, 2018 than there were in 2013, 2014. Right? So it's like a curve going up. So anyway, that's a long way of saying UIKit has a ridiculously large base of apps in there. And I think it'll take SwiftUI longer than Swift did to start penetrating that. But at the end of the day, I do believe it will overtake.

Paul Hudson: Should we give a shot to Objective-C today, too, with the presence of UIKit and SwiftUI? What do you think?

Sean Allen: No.

Well, these are my preferences. These are just all my opinions, right? But I just think there's only so many hours in the day, right? If you have 24 hours to dedicate to learning this stuff, sure. Learn, learn everything.

But in reality, you can only focus so many hours on this and you got to kind of spend those hours wisely. And if you're going to talk about cost benefit or return on investment, the return on investment in your time into Swift and UIKit, SwiftUI will be way more than Objective-C unless you plan on working for a large legacy app, like the YouTube app or Facebook, right? Those are still a lot of Objective-C. However, those are few and far between day by day.

Paul Hudson: What would Objective-C have to do to make you give it a second chance in 2020?

Sean Allen: Get rid of brackets. No, I mean, pay me a lot of money to work on an Objective-C project. I don't know. I'm not like, I don't want to make it come off as me bashing Objective-C. It's not that I hate it. It's just, again, back to the whole, where do I want to spend my time and where am I going to get the maximum return out of my time? And I just think going forward, me taking the time to learn Objective-C, is not going to give me a lot of compounding benefit over the next few years.

“You'd have to back up the money truck and dump it for me to do that probably.”

Paul Hudson: Yeah. There's only so many hours in the day and you get to choose what you learn that time. And what, two thirds of that you're building stuff and the remaining one third you're learning stuff. How are you breaking down your time? There are thousands of API in UIKit I've never even touched and they are amazing and fun to play with.

But you might say, “huh, I fancy noodling around with CoreML today or Core Haptics today.” Or you want to try something new because it's a fun language to work with. And then they say, “Yeah, I'll just cut a bit off and do some Objective-C.” No.

Sean Allen: Like I said, you'd have to back up the money truck and dump it for me to do that probably.

This transcript was recorded as part of Swiftly Speaking. You can watch the full original episode on YouTube, or subscribe to the audio version on Apple Podcasts.

Listen on Apple Podcasts

Hacking with Swift is sponsored by Stream

SPONSORED Check out Stream's cross-platform open source chat SDK on GitHub! Write once and deploy your app with fully featured chat UI on iOS and macOS.

Go to GitHub

Sponsor Hacking with Swift and reach the world's largest Swift community!

BUY OUR BOOKS
Buy Pro Swift Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift (Vapor Edition) Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Server-Side Swift (Kitura Edition) Buy Beyond Code

Was this page useful? Let us know!

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.