How to add constraints programmatically using Swift

Do you plan to have a squared UIView of width: 100 and Height: 100 centered inside the UIView of an UIViewController? If so, you may try one of the 6 following Auto Layout styles (Swift 5 / iOS 12.2): 1. Using NSLayoutConstraint initializer override func viewDidLoad() { let newView = UIView() newView.backgroundColor = UIColor.red view.addSubview(newView) … Read more

tech