2๏ธโฃUIKit
Fall 2023 | Richie Sun
What is UIKit?
UIKit provides a variety of features for building apps, including components we can use to construct the core structure of our iOS apps. The framework provides the core objects that we need to build apps for iOS. We use these objects to display our content onscreen, to interact with that content, and to manage interactions with the system. Apps rely on UIKit for their basic behavior, and UIKit provides many ways for us to customize that behavior to match our specific needs.
Create Views in UIKit
The UIKit framework provides an extensive library of classes that represent different kinds of views that we can utilize in our mobile apps. Thus, in order to create and customize these views, we need a basic understanding of classes, properties, methods, and inheritance. For example, suppose we wanted to display a title with a single line of text, we would first call upon the constructor to create an instance of UILabel
:
Every view has a different set of properties that we can utilize to customize our frontend view. In the case of the UILabel, we can define many elements of the text such as, text
, font
, textColor
, textAlignment
, etc.
Thus, we are able to change the properties of the UILabel to display a customized view for our iOS App.
Setting Up a UIKit Project Programmatically
Note that we will provide you with the setup in the assignments. However, this will be helpful for when you create a project on your own such as the Hack Challenge.
Before we write any code, let's make sure to properly set up our Swift files as detailed below. In this class we mainly teach UIKit with programmatic layout, and we DO NOT use Storyboard Swift. Follow the guide here:
๐จXcode Project SetupLast updated