I think I understand what @Andrew_Arnopoulos is getting at. I don't see any reason why the initial value of test
needs to be provided inline with the declaration, since it will ultimately be provided in the synthesized initializer. I don't see anywhere he's trying to initialize an instance of Multiple
without providing a wrappedValue
. The fully-expanded example would be:
// User writes
struct Test {
@Multiple(argument: 5) var test: String
}
// Compiler synthesizes:
struct Test {
var _test: Multiple<String>
var test: String {
get { _test.wrappedValue }
set { _test.wrappedValue = newValue }
}
init(test: String) {
_test = Multiple(wrappedValue: test, argument: 5)
}
}
Have I messed up the transformation for the property wrapper and/or the synthesized initializer somewhere?