Generic Structure


A type that publishes a property marked with an attribute.


@propertyWrapper struct Published<Value>


Publishing a property with the @Published attribute creates a publisher of this type. You access the publisher with the $ operator, as shown here:

class MyFoo {
    @Published var bar: String
    init(bar: String) { = bar
let foo = MyFoo(bar: "bar")
let barSink = foo.$bar
    .sink() {
        print("bar value: \($0)")


Creating a Published Instance

init(initialValue: Value)

Creates a publisher with the provided initial value.

Publishing the Value

var projectedValue: Published<Value>.Publisher

The property for which this instance exposes a publisher.

struct Published.Publisher

A publisher for properties marked with an attribute.

See Also


protocol Publisher

Declares that a type can transmit a sequence of values over time.

enum Publishers

A namespace for types that serve as publishers.

struct AnyPublisher

A publisher that performs type erasure by wrapping another publisher.

protocol ConnectablePublisher

A publisher that provides an explicit means of connecting and canceling publication.

protocol Cancellable

A protocol indicating that an activity or action supports cancellation.

class AnyCancellable

A type-erasing cancellable object that executes a provided closure when canceled.