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

Internal

  • 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 the ObjectReader instance uses to create views dynamically

    content

    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 the ObjectReader instance uses to create views dynamically

    content

    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 the ObjectReader instance uses to create views dynamically

    keyPath

    A KeyPath for a property in the ObjectSnapshot whose value will be sent to the views

    content

    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 the ObjectReader instance uses to create views dynamically

    keyPath

    A KeyPath for a property in the ObjectSnapshot whose value will be sent to the views

    content

    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.

View

  • Declaration

    Swift

    public var body: some View { get }