Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
You’ll be able to entry foo
and property
as an Argument
inside Mannequin
. Each property wrapped with a property wrapper declares a personal property of that property wrapper’s sort, prefixed with an underscore. You might be even assigning to the one for property
within the initialiser.
So below the hood, property
is definitely declared like:
personal var _property: Argument
var property: Int? {
get { _property.wrappedValue }
set { _property.wrappedValue = newValue }
}
Because it’s personal, you clearly cannot entry outdoors Mannequin
, however nothing stops you from exposing it 🙂
// in Mannequin
var publicProperty: Argument {
get { _property }
// undecided if a setter can be helpful...
// set { _property = newValue }
}
Then you may simply print it:
print(mannequin.publicProperty.argument)
You’ll be able to even make expose by modifying the property wrapper as an alternative, by making the property wrapper be its projected worth:
// in Argument
var projectedValue: Argument {
get { self }
// undecided if a setter can be helpful...
// set { self = newValue }
}
// Utilization: prefixing with a greenback signal will get the projected worth
print(mannequin.$property.argument)