A Swift macro package that provides the @FormBuilder macro for automatic, type-safe UI generation of SwiftUI forms based on your data model struct’s properties.
- Automatic Form Generation:
Annotate your SwiftUI view struct with@FormBuilderand automatically generate a completebodywith properly bound SwiftUI controls for each property. - Type Inference:
String→TextFieldBool→ToggleDate→DatePicker, etc.
- Reduces Boilerplate:
Focus on your data model, not repetitive form code. - Swift 5.9+ / Xcode 15+ Support:
Built using Swift's macro system and SwiftSyntax.
-
Import the Macro Package:
import FormBuilderMacros -
Use the Macro in Your SwiftUI View:
@FormBuilder struct EditContact: View { @State var name: String @State var number: String @State var isFavourite: Bool }The macro automatically generates this form's body with a
TextFieldandTogglebound to the properties.