ObjectReader
public struct ObjectReader<Object, Content, Placeholder, Value> : View where Object : DynamicObject, Content : View, Placeholder : View
A container view that reads changes to an ObjectPublisher
-
Creates an instance that creates views for
ObjectPublisher
changes.Declaration
Swift
public init( _ objectPublisher: ObjectPublisher<Object>?, @ViewBuilder content: @escaping (ObjectSnapshot<Object>) -> Content ) where Value == ObjectSnapshot<Object>, Placeholder == EmptyView
Parameters
objectPublisher
The
ObjectPublisher
that theObjectReader
instance uses to create views dynamicallycontent
The view builder that receives an
Optional<ObjectSnapshot<O>>
instance and creates views dynamically. -
Creates an instance that creates views for
ObjectPublisher
changes.Declaration
Swift
public init( _ objectPublisher: ObjectPublisher<Object>?, @ViewBuilder content: @escaping (ObjectSnapshot<Object>) -> Content, @ViewBuilder placeholder: @escaping () -> Placeholder ) where Value == ObjectSnapshot<Object>
Parameters
objectPublisher
The
ObjectPublisher
that theObjectReader
instance uses to create views dynamicallycontent
The view builder that receives an
Optional<ObjectSnapshot<O>>
instance and creates views dynamically.placeholder
The view builder that creates a view for
nil
objects. -
Creates an instance that creates views for
ObjectPublisher
changes.Declaration
Swift
public init( _ objectPublisher: ObjectPublisher<Object>?, keyPath: KeyPath<ObjectSnapshot<Object>, Value>, @ViewBuilder content: @escaping (Value) -> Content ) where Placeholder == EmptyView
Parameters
objectPublisher
The
ObjectPublisher
that theObjectReader
instance uses to create views dynamicallykeyPath
A
KeyPath
for a property in theObjectSnapshot
whose value will be sent to the viewscontent
The view builder that receives the value from the property
KeyPath
and creates views dynamically. -
Creates an instance that creates views for
ObjectPublisher
changes.Declaration
Swift
public init( _ objectPublisher: ObjectPublisher<Object>?, keyPath: KeyPath<ObjectSnapshot<Object>, Value>, @ViewBuilder content: @escaping (Value) -> Content, @ViewBuilder placeholder: @escaping () -> Placeholder ) where Placeholder == EmptyView
Parameters
objectPublisher
The
ObjectPublisher
that theObjectReader
instance uses to create views dynamicallykeyPath
A
KeyPath
for a property in theObjectSnapshot
whose value will be sent to the viewscontent
The view builder that receives the value from the property
KeyPath
and creates views dynamically.placeholder
The view builder that creates a view for
nil
objects.
-
Declaration
Swift
public var body: some View { get }