«`swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Create a UILabel
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 20))
label.text = «Hello, world!»
label.textAlignment = .center
label.textColor = .black
// Add the label to the view controller’s view
self.view.addSubview(label)
}
}
«`
This Swift program creates a simple UILabel with the text «Hello, world!» and adds it to the view controller’s view. When the view controller is loaded, the label will be visible on the screen.