Introduce a new experimental macro for generating memberwise initializers with reduced safety checks compared to @MemberwiseInit.
Features of @_UncheckedMemberwiseInit:
Include all properties in the initializer, regardless of access level
Include attributed properties by default (differs from @MemberwiseInit)
Allow exposure of lower access level members without per-member annotation
Has the same usage as @MemberwiseInit
@_UncheckedMemberwiseInit provides a trade-off between ease of use and compile-time safety, suitable for scenarios where brevity is preferred over strict access control enforcement. Note that the underscore prefix indicates this is an experimental feature.
Example:
@_UnsafeMemberwiseInit(.public)
public struct ViewModel {
private let title: String
}
Introduce a new experimental macro for generating memberwise initializers with reduced safety checks compared to
@MemberwiseInit
.Features of
@_UncheckedMemberwiseInit
:@MemberwiseInit
)@MemberwiseInit
@_UncheckedMemberwiseInit
provides a trade-off between ease of use and compile-time safety, suitable for scenarios where brevity is preferred over strict access control enforcement. Note that the underscore prefix indicates this is an experimental feature.Example:
Yields: