SmartPublished

@propertyWrapper
public struct SmartPublished<Value> : Codable where Value : Decodable, Value : Encodable
extension SmartPublished: PropertyWrapperInitializable

Undocumented

  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Undocumented

    Declaration

    Swift

    public var wrappedValue: Value { get set }
  • The publisher that exposes the wrapped value’s changes

    Declaration

    Swift

    public var projectedValue: Publisher { get }

Publisher Implementation

  • The publisher that broadcasts changes to the wrapped value.

    Uses CurrentValueSubject which:

    • Maintains the current value
    • Sends current value to new subscribers
    • More suitable than PassthroughSubject for property wrapper scenarios
    See more

    Declaration

    Swift

    public struct Publisher : Combine.Publisher
  • Undocumented

    Declaration

    Swift

    public init(wrappedValue: Value)
  • Custom subscript for property wrapper integration with ObservableObject.

    Declaration

    Swift

    public static subscript<OuterSelf: ObservableObject>(
        _enclosingInstance observed: OuterSelf,
        wrapped wrappedKeyPath: ReferenceWritableKeyPath<OuterSelf, Value>,
        storage storageKeyPath: ReferenceWritableKeyPath<OuterSelf, Self>
    ) -> Value

    Parameters

    observed

    The ObservableObject instance containing this property

    wrappedKeyPath

    Reference to the wrapped value

    storageKeyPath

    Reference to this property wrapper instance

PropertyWrapper

  • Creates an instance from any value if possible

    Declaration

    Swift

    public static func createInstance(with value: Any) -> SmartPublished?