A library for helping build high quality forms in SwiftUI and TCA
0

Configure Feed

Select the types of activity you want to include in your feed.

Infer validation builder expressions

Woodrow Melling (May 21, 2026, 9:30 PM -0600) ecc4abd8 a36a453c

+6 -2
+4
Sources/ComposableForms/Form.swift
··· 139 139 140 140 @resultBuilder 141 141 public enum ValidationBuilder<Value> { 142 + public static func buildExpression(_ validation: Validation<Value>) -> Validation<Value> { 143 + validation 144 + } 145 + 142 146 public static func buildBlock(_ validations: Validation<Value>...) -> [Validation<Value>] { 143 147 validations 144 148 }
+2 -2
Tests/ComposableFormsTests/FormTests.swift
··· 169 169 init() { 170 170 self.init { 171 171 TestForm.Field(\.name) { 172 - Validation<String>(error: .nameRequired) { !$0.isEmpty } 172 + Validation(error: .nameRequired) { !$0.isEmpty } 173 173 } 174 174 TestForm.Field(\.status) { 175 - Validation<String>(error: "Status is required") { !$0.isEmpty } 175 + Validation(error: "Status is required") { !$0.isEmpty } 176 176 } 177 177 } 178 178 }