Apple's original framework for building user interfaces on iOS. UIKit provides the essential infrastructure for iOS apps, including windows, views, view controllers, and user input handling.
of iOS users worldwide can use UIKit (iOS 2+ required)
| iOS Version | Market Share | Status |
|---|---|---|
| iOS 18.7 | 30.3% | Supported |
| iOS 18.6 | 29.8% | Supported |
| iOS 26.1 | 10.7% | Supported |
| iOS 18.5 | 6.0% | Supported |
| iOS 16.7 | 2.3% | Supported |
| iOS 26.2 | 2.0% | Supported |
| iOS 18.3 | 1.8% | Supported |
| iOS 15.8 | 1.8% | Supported |
| iOS 11.0 | 1.7% | Supported |
| iOS 17.6 | 1.7% | Supported |
View and view controller hierarchy
Touch and gesture recognition
Animations and visual effects
Navigation and tab bar controllers
Table and collection views
Auto Layout for responsive designs
Basic UIViewController with a label and button
import UIKit
class ViewController: UIViewController {
let label = UILabel()
let button = UIButton(type: .system)
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
// Configure label
label.text = "Hello, UIKit!"
label.font = .systemFont(ofSize: 24, weight: .bold)
label.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(label)
// Configure button
button.setTitle("Tap Me", for: .normal)
button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
// Layout constraints
NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
label.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: -50),
button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
button.topAnchor.constraint(equalTo: label.bottomAnchor, constant: 20)
])
}
@objc func buttonTapped() {
label.text = "Button Tapped!"
}
}Display a list of items using UITableView
import UIKit
class TableViewController: UITableViewController {
let items = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5"]
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = items[indexPath.row]
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
print("Selected: \(items[indexPath.row])")
}
}Animate view properties with UIView.animate
import UIKit
func animateView(_ view: UIView) {
// Fade in animation
view.alpha = 0
UIView.animate(withDuration: 0.5) {
view.alpha = 1
}
// Spring animation
UIView.animate(
withDuration: 0.6,
delay: 0,
usingSpringWithDamping: 0.5,
initialSpringVelocity: 0.5,
options: [],
animations: {
view.transform = CGAffineTransform(scaleX: 1.2, y: 1.2)
},
completion: { _ in
view.transform = .identity
}
)
}Apple's original framework for building user interfaces on iOS. UIKit provides the essential infrastructure for iOS apps, including windows, views, view controllers, and user input handling.
UIKit is available on iOS 2 and later. Currently, 99.8% of iOS users worldwide can use this framework.
Related frameworks include Swiftui, Foundation. Each has different capabilities and iOS version requirements.