PostPublished

@propertyWrapper
public class PostPublished<Value>

A type that publishes changes about its wrappedValue property after the property has changed (using didSet semantics). Reimplementation of Combine.Published, which uses willSet semantics. Source: https://stackoverflow.com/questions/69978018/observe-change-on-a-published-var-in-swift-combine-after-didset

  • A Publisher that emits the new value of wrappedValue after it was mutated (using didSet semantics).

    Declaration

    Swift

    public let projectedValue: AnyPublisher<Value, Never>
  • A Publisher that fires whenever wrappedValue was mutated. To access the new value of wrappedValue, access wrappedValue directly, this Publisher only signals a change, it doesn’t contain the changed value.

    Declaration

    Swift

    public let valueDidChange: AnyPublisher<Void, Never>
  • Undocumented

    Declaration

    Swift

    public var wrappedValue: Value { get set }
  • Initializer for a PostPublished property wrapper.

    Declaration

    Swift

    public init(wrappedValue: Value, emitCurrentValue: Bool = true)

    Parameters

    wrappedValue

    The initial value.

    emitCurrentValue

    Whether to emit the current wrapped value when subscribing to projectValue. When true then didChangeSubject will use a CurrentValueSubject and thus providing the last value. When false then didChangeSubjectwill use a PassthroughSubject instead and thus only passing new value updates. Defaults to true.