You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,11 +85,20 @@ struct AppStateBuilder {
85
85
```
86
86
87
87
### Limitations
88
-
- The list of default values is limited to the values specified in the below table. All other types will require another builder to be defined.
88
+
- The list of default values is limited to the values specified in the below table. All other types will require another builder to be defined
89
89
- The macro only works on `struct`, `enum` and `class` definitions
90
-
- If a builder for a specific declaration can not be generated, you can always choose to create it yourself.
91
-
- About classes: The macro uses the first initialiser of a class if multiple initialiser exist.
92
-
- About structs: The macro makes a best guess to decide how the implicit memberwise initializer could look like and might fail for some unforeseen declarations.
90
+
- If a builder for a specific declaration can not be generated, you can always choose to create it yourself by following the below builder naming pattern:
91
+
```swift
92
+
struct <MyType>Builder {
93
+
94
+
funcbuild() -> <MyType> {
95
+
return...
96
+
}
97
+
}
98
+
```
99
+
- If a classor a struct has one or more initialisers, the macro will use the first/top one
100
+
- For structs without an initialiser, the macro makes a best guess to decide how the implicit memberwise initializer could look like. This best guess might fail for declarations that have not been considered during implementation of the macro.
101
+
- As of Swift 5.9 (13.02.2024) it is not possible to use the generated builders inside the SwiftUI `#Preview` closure.
93
102
94
103
### Specified default values
95
104
The list of default values is limited to the values specified in the below table.
0 commit comments