Checklist
Request
When sharing an @Store object from a view to its subview, this is legal with an implicit initializer:
struct Superview: View {
@Store var object: StoreType
var body: some View {
Subview(object: self.object)
}
}
struct Subview: View {
@Store var object: StoreType
var body: some View {
// ...
}
}
but it's not clear from the documentation whether this is good practice or not. Furthermore, this becomes more complicated with an explicit initializer, since Store.wrappedValue is get-only:
struct Superview: View {
@Store var object: StoreType
var body: some View {
Subview(object: self._object)
}
}
struct Subview: View {
@Store var object: StoreType
init(object: Store<StoreType>) {
self._object = object
// then, property access must be done as either
self.object.someThing
// or
object.wrappedValue.someThing
}
var body: some View {
// ...
}
}
In some cases, it may not be necessary for them to both be @Store, but this prevents both views from accessing the projected value $object.
Checklist
Request
When sharing an
@Storeobject from a view to its subview, this is legal with an implicit initializer:but it's not clear from the documentation whether this is good practice or not. Furthermore, this becomes more complicated with an explicit initializer, since
Store.wrappedValueis get-only:In some cases, it may not be necessary for them to both be
@Store, but this prevents both views from accessing the projected value$object.