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
}
}
}
Also in Swift:
- swift credit card validate
- if statement swfit
- core data save
- playing a sound in swift
- swift remove tableview cell
- swift stirng to date
- swift thread.sleep
- swift retrieve value from dictionary
- duplicate modifier swiftui error
- swift add navigation bar
- activity indicator swiftui
- localized string format swift
- button click programmatically swift
- swift parse json
- swift navigation bar title font
- how to add two right bar button item xcode
- swift change enum value
- swift uiview gradient
- change textfield placeholder color swiftui
- markdown
- get address from latitude and longitude in swift
- swift pop view controller
- Resizing UITableView to fit content
- swift create label programmatically