Question: how to create uiview programmatically in ios swift?
Answer: import UIKit. class ViewController: UIViewController { // Do any additional setup after loading the view, typically from a nib. let myNewView=UIView(frame: CGRect(x: 10, y: 100, width: 300, height: 200)) // Change UIView background colour. myNewView.backgroundColor=UIColor.lightGray. // Add rounded corners to UIView.