Answers for "how do you set so a field receives only numbers in xcode"

1

uitextfield numbers only

//class ViewController: UIViewController, UITextInputTraits {

@IBOutlet weak var textFieldKeyboardType: UITextField!{
    didSet{
        textFieldKeyboardType.keyboardType = UIKeyboardType.NumberPad
    }
}
var keyboardType: UIKeyboardType { 
    get{ 
        return textFieldKeyboardType.keyboardType
    } 
    set{ 
        if newValue != UIKeyboardType.NumberPad{
            self.keyboardType = UIKeyboardType.NumberPad
        }
    } 
}
Posted by: Guest on December-23-2020

Code answers related to "how do you set so a field receives only numbers in xcode"

Code answers related to "Swift"

Browse Popular Code Answers by Language