Skip to content

Commit dfdc33e

Browse files
author
Alexander Schmutz
committed
Update documentation
1 parent 7a2f5df commit dfdc33e

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,20 @@ struct AppStateBuilder {
8585
```
8686

8787
### 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
8989
- 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+
func build() -> <MyType> {
95+
return ...
96+
}
97+
}
98+
```
99+
- If a class or 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.
93102

94103
### Specified default values
95104
The list of default values is limited to the values specified in the below table.

0 commit comments

Comments
 (0)