I\'m new to Swift and iOS programming. I was trying to create a UITextField
programmatically using Swift but couldn\'t get it quite right. Also how do you change it
You can use below code with Swift 5.2:
lazy var titleTextField:UITextField = {
let textField = UITextField()
textField.translatesAutoresizingMaskIntoConstraints = false
textField.placeholder = "Title *"
textField.keyboardType = UIKeyboardType.default
textField.returnKeyType = UIReturnKeyType.done
textField.autocorrectionType = UITextAutocorrectionType.no
textField.font = UIFont.systemFont(ofSize: 13)
textField.borderStyle = UITextField.BorderStyle.roundedRect
textField.clearButtonMode = UITextField.ViewMode.whileEditing;
textField.contentVerticalAlignment = UIControl.ContentVerticalAlignment.center
return textField
}()