Releases: gohanlon/swift-memberwise-init-macro
0.5.1
What's Changed
- Fixed: Swift Testing had breaking changes during the Swift 6 beta period (thanks to upstream work by @noremac and pointfreeco/swift-macro-testing)
Full Changelog: 0.5.0...0.5.1
0.5.0
What's Changed
- Added: Support for SwiftSyntax 600.0.0-latest (#39)
- Added:
@_UncheckedMemberwiseInit
macro (experimental) to generate a memberwise initializer for all properties, regardless of access level, with reduced compile-time safety checks (compared to@MemberwiseInit
). (#36) - Fixed: Updated references to Swift GitHub organization from
github/apple
togithub/swiftlang
(thanks @junebash, #41) - Added: Beta support for Swift Testing (thanks pointfreeco/swift-macro-testing#25, #38)
- Infrastructure: Added Makefile task to locally test multiple SwiftSyntax versions
- Infrastructure: Updated CI workflow to test against SwiftSyntax 600.0.0-latest
New Contributors
Full Changelog: 0.4.0...0.5.0
0.4.0
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
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 providedinit
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 supportlet
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