Generic Structure

NSObject.KeyValueObservingPublisher

A Combine publisher that produces a new element whenever the observed value changes.

Declaration

struct KeyValueObservingPublisher<Subject, Value> where Subject : NSObject

Overview

Use this publisher to integrate a property that’s compliant with key-value observing into a Combine publishing chain. You can create a publisher of this type with the NSObject instance method publisher(for:options:), passing in the key path and a set of NSKeyValueObservingOptions.

Topics

Creating a KVO Publisher

init(object: Subject, keyPath: KeyPath<Subject, Value>, options: NSKeyValueObservingOptions)

Creates a key-value observing publisher for the given combination of object and key path, using publishing behavior options you provide.

Inspecting KVO Publisher Properties

let object: Subject

The object that contains the property to publish.

let keyPath: KeyPath<Subject, Value>

The key path, relative to the object receiving this message, of the property to publish.

let options: NSKeyValueObservingOptions

Options that determine which elements the publisher produces.

Relationships

Conforms To

See Also