From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

UIKit extensions and pseudo SwiftUI

UIKit extensions and pseudo SwiftUI

From the course: iOS Development Tips

UIKit extensions and pseudo SwiftUI

- [Instructor] I do a lot of prototyping and playing around with code, both in Playgrounds and Xcode. Often, I need a fast labeler button and I don't want to spend too long configuring it. I made a series of extensions of how I usually make buttons and labels all arranged in stacks. It's a pseudo-Swift UI for making things quickly in UIKit. Let's use it to explain how to work with extensions to UI views. If you open the OS X file, you'll find a playground where I've started this process with labels. So if you go ahead and run this, you'll see the two labels show up. Let's go ahead and close the live view with a cmd+return. And let's go look at some code here. If you go to viewDidLoad, you'll see that I loaded my VStack extension which I called UIStackView.VStack with the two labels in an array. And then inside those two labels, I have the label as essentially. In one case, I just made a literal label, and in the…

Contents