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
UITextField
Try below code
var textFiled = UITextField(frame: CGRectMake(20.0, 30.0, 100.0, 33.0)) textFiled.backgroundColor = UIColor.redColor() textFiled.borderStyle = UITextBorderStyle.Line self.view.addSubview(textFiled)