Inputs and forms · 17 free pieces

SwiftUI input fields and form controls

The inputs SwiftUI still leaves hard: a floating-label text field with validation, a password strength field, currency and token fields, a date range picker, range sliders, and a map location picker.

All components

About these pieces

One self-contained Swift file each, Apple frameworks only, from iOS 17.

Form Field is a text field whose label rests inside as a placeholder and glides up on focus, with a character limit, help text and validation that waits until you leave the field before it shows an error. Secure Entry adds a reveal toggle, a four-step strength bar and requirement chips. Amount Field formats currency live in the user's locale on a Decimal binding. Token Field turns entries into wrapping chips for tags and recipients, with paste of a whole list and inline suggestions.

For picking values: Range Slider is a dual-thumb slider whose thumbs never cross, Expanding Track is a thumbless slider that swells under the finger, Scrub Stepper steps by tap, hold or a sideways scrub, Date Range Picker selects a start and end date on a paged month grid, and Filter Rail is a scrolling row of filter chips.

For places: Location Picker is a map you drag under a fixed pin that lifts while the map moves and drops when it settles, then looks up the address with stale answers cancelled and recent ones cached. It uses MapKit's reverse geocoding on iOS 26 with a fallback before it, and asks for location only when the locate button is tapped.

Learn the technique: SwiftUI haptics guide.

Questions

How the pieces work, and how to build the same thing yourself. Every piece's page has its full notes.

Does SwiftUI have a range slider with two thumbs?

No. SwiftUI's Slider has one thumb. Range Slider adds a dual-thumb control with step snapping, a minimum gap, thumbs that never cross, and a haptic on every step.

How do I make a floating label text field in SwiftUI?

Overlay the label on the field and move and scale it up when the field is focused or has text, driven by @FocusState. Form Field does this and adds validation, a character counter and VoiceOver announcements.

How do I make a map location picker in SwiftUI?

Keep a pin fixed over the centre of a Map, follow the camera with onMapCameraChange, and look up the address only after the camera settles, cancelling any lookup a newer move replaces. Location Picker does this with a lifting pin, a cached geocoder and an address card with loading and failure states.

How do I format currency input in SwiftUI?

Keep the value as a Decimal and format it with the user's locale as digits arrive, rather than binding a TextField to a formatted string. Amount Field handles grouping, the decimal separator, symbol position and pasted amounts.

Ready to build something better?

85 pieces, one file each, yours to keep. Start with the library or see what the whole app looks like.