With Currency Field you can create a numerical input field most commonly found in banking apps. The user types in the amount, and the digits fill in from the right. It uses a UITextField for custom input, and a SwiftUI.Text to display the formatted value which allows for easy styling. This also makes it possible to use the .focused() modifier to update its first responder state.
CurrencyField
With Currency Field you can create a numerical input field most commonly found in banking apps. The user types in the amount, and the digits fill in from the right. It uses a
UITextFieldfor custom input, and aSwiftUI.Textto display the formatted value which allows for easy styling. This also makes it possible to use the.focused()modifier to update its first responder state.Example:
Installation
Swift Package Manager
Sample Usage
Intrepresenting the amount in cents.Using a Custom Number Formatter
Credits
This package was originally inspired by this tutorial: Currency TextField in SwiftUI
License
CurrencyFieldis available under the MIT license. See the LICENSE for more info.