Created
December 24, 2017 06:52
-
-
Save anonymous/1a4bf1ab9a7ccdfb636db4f08b87c356 to your computer and use it in GitHub Desktop.
textfield function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | |
if let digit = Int(string) { | |
amount = amount * 10 + digit | |
textField.text = String(describing: currencyAmount()!) | |
} else if string == "" { | |
amount = amount / 10 | |
textField.text = String(describing: currencyAmount()!) | |
} | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment