Releases: alschmut/SwiftBuildableMacro
Releases · alschmut/SwiftBuildableMacro
v2.0.0 Respect access level
Breaking change
- Previously the generated builder would always have the implicit
internalaccess level. Starting with v2.0.0 by default the generated builder adopts the same access level of the original annotated struct/class/enum.
New Features
- To adjust the access level of the builder, set the new desired
accessLevelmacro parameter@Buildable(accessLevel: AccessLevel? = nil)to one of the following values:private,fileprivate,internal,packageorpublic. The desired access level must not be of higher visibility than the original struct/class/enum. - The macro now generates explicit initializers when the builder's accessLevel is
packageorpublic - The swift-syntax dependency can now be resolved with older versions as well. The minimum version is 600.0.0
Internal updates
- The swift-syntax dependency now links to the new swiftlang organization git repository: https://github.com/swiftlang/swift-syntax
Fixes
- Fix an issue, where the builder fails to be generated when the original struct or class has a
fileprivatevariable.
v1.2.1
v1.2.0 Support Sendable conformance for expanded builders
When the original struct, class or enum explicitly conforms to Sendable then the expanded/generated Builder also conforms to Sendable. See the below example:
@Buildable
struct Person: Sendable {
let name: String
}
// Expanded
struct PersonBuilder : Sendable {
var name: String = ""
func build() -> Person {
return Person(
name: name
)
}
}v0.5.0
- Changed module name from
StructBuildertoBuildable. Please update your linked package in the Xcode settings and update the import statements accordingly. - Changed behaviour when generating struct builder. When a struct initialiser exists
@Buildablenow uses the first/top initialiser instead of guessing what the initialiser could look like from the struct member variables - Fixed an issue where generating a struct builder would fail when a constant
let myConstant = ""would be part of the struct. An initialised constant can not be part of a member-wise initialiser.