How to learn modern UIKit?

Take the first steps with me to learn how to build user interfaces using the UIKit framework. Programmatically in Swift, without storyboards.

UIKit

UI frameworks in 2020

I always tell everyone that the hardest part of the job is building a proper user interface. Providing the best user experience can be challenging since the designer has to follow the Human Interface Guidelines, come up with a nice looking design, sometimes deal with the client to find the best solution for the end-user. My really good friend Ákos Véber could tell you more about this (maybe he will in a future post), but let's just stop here.

What are the available options to implement graphical user interfaces using Swift?


SwiftUI

Apple released SwiftUI in 2019, the framework is still hot & crispy or should I say half-baked? Lots of the people instantly started to work with SwiftUI right after the WWDC announcement and I was quite unhappy with the initial feedbacks. SwiftUI is the future, that's for sure. I believe that Apple will put a lot of effort into the framework to make it better. Conceptually it's already great, the implementation is 'kay, but still my big problem here is that I don't see yet how SwiftUI can improve my everyday work. 🤔

The declarative interface definition is a hot topic nowadays, but do we really need it? I mean yeah for basic prototyping it's super fast, but if you have to solve complex issues (or even some trivial ones like setting the offset of a scroll view) you have to fight the system or come up with your own UIViewRepresentable object.

The truth is: if you choose SwiftUI you still have to interact a LOT with UIKit as well.

Anyway, people have various needs. IMHO SwiftUI is here because of Flutter & React Native. Developers love these frameworks. Apple had to come up with a new solution to compeete with them, since they want more and more talented Swift coders to work natively on iOS apps instead of hybrid ones. From a newcomers perspective it's really charming to choose SwiftUI. I'm still impressed how much you can do with it even in this early stage.

Should you learn SwiftUI?

Yes, definitely if you are already familiar with UIKit, just go and learn SwiftUI. If you don't have UIKit experience at all you still can master SwiftUI, but you might find yourself searching a lot for UIKit related questions. 🔍

Shoud you learn SwiftUI or UIKit?

Well, knowing what I know I'd start with UIKit. It's really tempting to "hang with the cool kid", but is it worth skipping an entire class? Paul Hudson already asnwered this question, this is what I also think:

What I’m trying to say is that the existence of SwiftUI hasn’t somehow rendered UIKit obsolete: if you intend to get an iOS development job within the next three years, knowing how to use UIKit will either be a firm requirement or a strong bonus.

UIKit

UIKit is now available on the following platforms: iOS (iPadOS), tvOS, macOS (Catalyst). That's pretty much all of them, except watchOS. The framework itself is a huge one, since it contains every single basic building block that you can see and use on iOS. It's not just views, but controllers, navigation, responders and many more.

Where should you start learning UIKit?

Are you looking for a modern UIKit tutorial? Well, that can be quite difficult, since most of the books and courses are outdated. However I have to recommend one really promising video course by Sean Allen. He is building a complete app, teaching you the basics of networking, collection views, search controllers proper state management and lots of small practices that you'll find very useful if you want to start your career as an iOS developer. It's like a takeaway project tutorial for a job interview. Really useful! 🎬

Your other option is to join me and learn how UIKit works step-by-step on a weekly basis. I'm going to release articles about all the best practices that I learned in the past. It's going to be 100% written in the latest version of Swift, without storyboards or nibs. These are going to be longer articles and each time I'm going to focus on a practical lesson that's useful in a real world project. What's the plan?

My upcoming UIKit tutorials*

1. How to start an iOS project using UIKit?
Project setup, Basic UIKit concepts, AppDelegate, SceneDelegate
2. Learning how UIKit navigation works
UINavigationController, UITabBarController, UISplitViewController, UIPageViewController
3. All about the UIViewController class
UIViewController lifecycle, subclassing, composition using child view controllers
4. UIView fundamentals, working with custom views
UIView lifecycle, the layout system, custom UIView subclass, a little bit about layers
5. Layout anchors with UILabel, UIButton, UIImageView
Learn how to build up your screens by using layout anchors and basic UIKit components
6. Modren UITableView using diffable datasources
Using the search field, remote image loading, etc.
7. The UI stack, states, alerts, transitions, animations
UIAlertController, UIActivityIndicatorView and some fancy effects
8. Buildling complex user interfaces with UICollectionView
Composition layout, plus I have a new crazy idea for reusable cells based on SwiftUI...
9. Creating complex input forms using a UIStackView and a UIScrollView
Using: UITextField, UISlider, UIStepper, UIDatePicker, UISegmentedControl, UISwitch
10. Supporting bigger screens, iPad, macOS (Catalyst) and dark mode
Windows, adaptivity, drag & drop basics, touch recognizers

* please note: it's just a basic skeleton, content may vary in the future.

Count me in, when do we start?

I'm planning to release the first issue later on this year. When I'm ready with the content, each and every week you should expect a new UIKit article with a little task that you can solve on your own (maybe you'll need a little research work). I'm really excited about this, I hope that you'll enjoy this new format of tutorials, please join me, spread the word (on Twitter) and most importantly have fun! More details are coming soon... 🤫


I need your help!

As I mentioned this before, this year I'd like to focus most of my the time on this site. This means more frequent updates with better tutorials, but the most important question is:

What's your preferred learning method?
  • Books
  • Swift playground books
  • Video courses
  • Live coding projects

Please tell me your opinion, you can use this poll on Twitter to make a choice. Stay tuned, more articles are coming soon, if you like what I do please subscribe to my monthly newsletter below. ⬇️

Picture of Tibor Bödecs

Tibor Bödecs

Creator of https://theswiftdev.com (weekly Swift articles), server side Swift enthusiast, full-time dad. -- Follow me & feel free to say hi. 🤘🏻 -- #iOSDev #SwiftLang

Twitter · GitHub

📬

100% Swift news, delivered right into your mailbox

Subscribe to my monthly newsletter. On the first Monday of every month, you'll get an update about the latest Swift news including my articles and everything what happend in the Swift community as well.