Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levi/f6ccbcbcbf250e00f2dd4175a182903f to your computer and use it in GitHub Desktop.
Save levi/f6ccbcbcbf250e00f2dd4175a182903f to your computer and use it in GitHub Desktop.
textfield function
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