Skip to content

Releases: alschmut/SwiftBuildableMacro

v2.0.0 Respect access level

19 Oct 14:30

Choose a tag to compare

Breaking change

  • Previously the generated builder would always have the implicit internal access 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 accessLevel macro parameter @Buildable(accessLevel: AccessLevel? = nil) to one of the following values: private, fileprivate, internal, package or public. 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 package or public
  • The swift-syntax dependency can now be resolved with older versions as well. The minimum version is 600.0.0

Internal updates

Fixes

  • Fix an issue, where the builder fails to be generated when the original struct or class has a fileprivate variable.

v1.2.1

02 Oct 15:35

Choose a tag to compare

  • Update swift-tools-version to from 5.9 to 6.2
  • swift-syntax dependency from 510.0.0 to 602.0.0
  • Fix internal build issue regarding imported Foundation and swift concurrency

v1.2.0 Support Sendable conformance for expanded builders

14 May 09:04

Choose a tag to compare

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

13 Feb 16:46

Choose a tag to compare

v0.5.0 Pre-release
Pre-release
  • Changed module name from StructBuilder to Buildable. 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 @Buildable now 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.

v0.4.0

09 Feb 17:00

Choose a tag to compare

v0.4.0 Pre-release
Pre-release

Added ability to annotate class declarations with @Buildable.

v0.3.0

09 Feb 15:45

Choose a tag to compare

v0.3.0 Pre-release
Pre-release

Added ability to annotate enum declarations with @Buildable, which produces a builder struct using the first found enum case as their default value.