Contents

marcelvoss/atmtextfield

ATMTextField is a custom SwiftUI text field for entering currency amounts in an ATM-style format.

Installation

Swift Package Manager

You can install ATMTextField using Swift Package Manager. Add the following dependency to your Package.swift or through Xcode:

.package(url: "https://github.com/marcelvoss/ATMTextField.git", .upToNextMajor(from: "1.0.0"))

Usage

Using ATMTextField is simple. Declare a @State property of type Decimal and bind it to the amount parameter:

@State private var currencyValue: Decimal = .zero

CurrencyTextField(amount: $currencyValue, currencyCode: "EUR")

By default:

  • The field treats 0 as a placeholder value and styles it with a secondary color.
  • The maximum value is set to 999_999_999.99, but this can be customized.

You can modify these behaviors:

ATMTextField(
    amount: $currencyValue,
    currencyCode: "USD",
    treatZeroAsPlaceholder: false,
    maximumValue: 1_000_000
)

License

ATMTextField is available under the MIT license. See the LICENSE file for details.

Package Metadata

Repository: marcelvoss/atmtextfield

Default branch: main

README: README.md