Answers for "swift check text field only numbers"

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 "swift check text field only numbers"

Code answers related to "Swift"

Browse Popular Code Answers by Language