Repository Public MIT
1{2 "accessibility" : [3 "The visible label is the accessibility label of the field; \"Required\" is appended for required fields.",4 "An error is an icon plus a sentence, read as \"Error: …\"; it is never colour alone.",5 "Label, value and messages follow Dynamic Type and wrap.",6 "Default messages are localised (English, French); lengths count user-perceived characters."7 ],8 "category" : "forms",9 "changelog" : [10 {11 "changes" : [12 "Initial release."13 ],14 "date" : "2026-12-02",15 "version" : "1.0.0"16 }17 ],18 "dependencies" : [19 {20 "id" : "glass-forms-support",21 "version" : "1.0.0"22 },23 {24 "id" : "glass-foundation",25 "version" : "1.0.0"26 }27 ],28 "description" : "Text field with label, validation message, focus handling and keyboard configuration.",29 "examples" : [30 {31 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassTextFieldExample: GlassExample {\n public static let componentID = \"glass-text-field\"\n @State private var name = \"\"\n @State private var email = \"\"\n @State private var handle = \"taken\"\n @State private var locked = \"Read-only value\"\n @FocusState private var emailFocused: Bool\n\n public init() {}\n\n public var body: some View {\n ScrollView {\n VStack(alignment: .leading, spacing: 20) {\n GlassTextField(\n \"Full name\",\n text: $name,\n prompt: \"Ada Lovelace\",\n validation: GlassFieldValidation(.required(), .minLength(2)),\n input: .name\n )\n .onSubmit { emailFocused = true }\n\n GlassTextField(\n \"Email\",\n text: $email,\n prompt: \"name@example.com\",\n helper: \"Used only for the receipt.\",\n validation: GlassFieldValidation(.required(), .custom(message: \"Enter an address such as name@example.com\") { $0.contains(\"@\") && $0.contains(\".\") }),\n input: .email,\n focus: $emailFocused\n )\n\n GlassTextField(\n \"Username\",\n text: $handle,\n validation: GlassFieldValidation(.maxLength(12)),\n validateOn: .always,\n errorMessage: handle == \"taken\" ? \"This username is already taken.\" : nil,\n input: .username\n )\n\n GlassTextField(\"Account\", text: $locked)\n .disabled(true)\n\n Button(\"Focus the email field\") { emailFocused = true }\n }\n .padding()\n }\n }\n}\n\n#Preview(\"GlassTextField\") { GlassTextFieldExample().glassTheme(.aurora) }\n",32 "title" : "GlassTextField example"33 }34 ],35 "files" : [36 {37 "bytes" : 5196,38 "path" : "Forms/Forms/GlassTextField.swift",39 "sha256" : "3ddf50a0ec01caf8d656563b4cb22cdc0113c9ece5c9f53b4d086405106291bd"40 }41 ],42 "frameworks" : [4344 ],45 "id" : "glass-text-field",46 "kind" : "content-component",47 "license" : "MIT",48 "minimumOS" : {49 "iOS" : "26.0",50 "iPadOS" : "26.0",51 "macOS" : "26.0"52 },53 "name" : "GlassTextField",54 "platforms" : [55 "iOS",56 "iPadOS",57 "macOS"58 ],59 "schemaVersion" : 1,60 "sha256" : "f07c9b6e400e6877f37ac0d8e13dd07e117c157888768bc7b4f87513cca4c829",61 "symbols" : [62 "GlassTextField"63 ],64 "version" : "1.0.0"65}66