What is UIKit?
Answer
UIKit is Apple's foundational UI framework for building iOS and tvOS applications. It provides the core infrastructure for all UI-based apps — the event loop, view hierarchy, user interaction handling, and all built-in UI components. Core concepts: (1) UIApplication: the singleton that manages the app's life cycle and dispatches events; (2) AppDelegate / SceneDelegate: responds to app and scene lifecycle events (launch, background, foreground, termination); (3) UIViewController: manages a view and its lifecycle — the primary building block of an iOS app's UI; (4) UIView: the base class for all visual elements. Views define layout and drawing. Everything visible is a UIView (or subclass); (5) UIWindow: the top-level container that hosts the view hierarchy. Common UIKit components: UILabel, UIButton, UITextField, UITextView, UIImageView, UITableView, UICollectionView, UIScrollView, UIStackView, UINavigationController, UITabBarController, UIAlertController. View hierarchy: UIWindow → UIView → subviews → sub-subviews. Rendering goes from root to leaves. Auto Layout: constraint-based layout system. Constraints define relationships between views: view.topAnchor.constraint(equalTo: parent.topAnchor, constant: 16).isActive = true. Storyboard vs Programmatic UI: Storyboard — visual editor in Xcode, IBOutlets/IBActions; Programmatic — create views entirely in code (more control, better for teams). Many modern apps use programmatic UI or SwiftUI.
Previous
What is ARC (Automatic Reference Counting) in Swift?
Next
What is the UIViewController lifecycle?