SwiftUI.cc
SwiftUI collection

Text & Input SwiftUI reference

Focused SwiftUI text & input pages with original examples, usage guidance, and implementation notes.

Showing 1-8 of 8 reference pages

Style Text with dynamic type styles, fontWeight, fontDesign, and fontWidth; load custom fonts with relative scaling so typography still respects accessibility.

4 min readOpen

Pass format styles directly to Text — currencies, percents, dates, measurements, lists, and even live timers — and get localization for free.

5 min readOpen

Control how text behaves under pressure: lineLimit and reserved space, minimumScaleFactor shrinking, truncationMode, tightening, and line spacing.

4 min readOpen

Text literals parse Markdown — bold, italics, code, links — while AttributedString unlocks programmatic runs, custom attributes, and styled interpolation.

4 min readOpen

TextField binds editable text with a placeholder label, keyboardType for input-appropriate keys, textContentType for autofill, and capitalization and autocorrection control.

4 min readOpen

@FocusState moves the cursor programmatically, onSubmit chains fields through return, and onChange validates as users type — the wiring of real forms.

5 min readOpen

SecureField masks input for secrets, pairs with textContentType for password managers and strong-password suggestions, and composes with TextField for reveal toggles.

3 min readOpen

TextEditor binds long-form scrolling text. Style with font and lineSpacing, restyle backgrounds via scrollContentBackground, and manage the keyboard with focus and toolbars.

4 min readOpen