Skip to content

Releases: gohanlon/swift-memberwise-init-macro

0.4.0

20 Apr 00:08
Compare
Choose a tag to compare

What's Changed

  • Added: Support for SwiftSyntax 510 (#34). For now, SwiftSyntax 509 is also supported.
  • Added: Fix-its for access level leaks (#32).
  • Infrastructure: Added matrix testing for multiple versions of SwiftSyntax on macOS CI; Linux CI updated to Swift 5.10.
  • Infrastructure: Added ReadmeTests.swift to validate documentation examples and track changes to their behavior.
  • Infrastructure: Tests now support fix-its that cannot be simultaneously applied and an option to skip applying fix-its.

Full Changelog: 0.3.0...0.4.0

0.3.0

15 Dec 06:01
Compare
Choose a tag to compare

What's Changed

  • Changed: Provide an init at the specified access level or fail (#10). @MemberwiseInit has traditionally mirrored Swift’s memberwise initializer, adapting to the access levels of properties. This adapting behavior is necessary for Swift's initializer, which operates without explicit developer intent.

    However, @MemberwiseInit(.public) has the advantage of explicit, specific developer intent: add a public initializer. Now, any restricted properties that would have access leaked via the provided init will trigger diagnostics. This makes MemberwiseInit simpler to use, more obvious and incrementally learnable, and is still safe by default.

  • Deprecated: @Init(.escaping) is deprecated in favor of @Init(escaping: true). Existing uses will trigger a warning with a fix-it.

  • Fixed: Diagnostic concerning custom 'label' on multiple bindings being misdiagnosed (#20).

  • Added: @InitWrapper(type:) to initialize properties that are wrapped by a property wrapper and require direct initialization using the property wrapper’s type, e.g. @InitWrapper(type: Binding<Int>) @Binding var number: Int.

  • Added: Add @Init(default:) to support let property default values (#12).

  • Added: Support for packages access level (thanks @davdroman, #6).

  • Added: Warning diagnostic: ⚠️ @Init can't be applied to already initialized constant (with fix-its). Note: This will escalate to an error in version 1.0.

  • Added: Warning diagnostic: ⚠️ @Init can't be applied to 'static' members (with fix-it). Note: This will escalate to an error in version 1.0.

  • Added: Warning diagnostic: ⚠️ @Init can't be applied to 'lazy' members (with fix-it). Note: This will escalate to an error in version 1.0.

  • Added: @InitRaw macro to provide direct configurability over 'accessLevel', 'assignee', 'default', 'escaping', 'label', and 'type'.

  • Added: Error diagnostic: 🛑 Multiple @Init configurations are not supported by @MemberwiseInit when multiple @Init configurations are applied to a single property

Full Changelog: 0.2.0...0.3.0

0.2.0

14 Nov 19:54
Compare
Choose a tag to compare

What's Changed

  • Added: Infer type from property initialization expression syntax (#4). Supports simple expressions like var number = 0 and many more complex expressions like var doubles = [1, 2, 3.0].

Full Changelog: 0.1.1...0.2.0

0.1.1

09 Nov 05:44
Compare
Choose a tag to compare

What's Changed

  • Fixed: Make optional var properties default to nil for non-public inits (#2).

Full Changelog: 0.1.0...0.1.1

0.1.0

06 Nov 02:22
Compare
Choose a tag to compare
  • Initial release.