Combine — Foundations Skill
Purpose
Route Combine implementation tasks to the minimum required Combine
Knowledge Contracts. v1 scope is the Publisher/Subscriber/sink/
AnyCancellable subscription contract, @Published/ObservableObject,
PassthroughSubject/CurrentValueSubject, the core transforming/
combining operators, and assign(to:on:)/assign(to:) with cancellable
lifetime management -- not async/await interop, custom conformances,
backpressure, or SwiftData/Core Data interop.
Routing
Load only the contracts relevant to the task. All paths relative to knowledge/combine/.
- Subscribing with
sink(receiveCompletion:receiveValue:)orsink(receiveValue:); asking whetherFailure == Neverapplies; or reasoning about retaining/discarding anAnyCancellable-> publishers-and-subscribers.md - Declaring
@Published var x; accessing$x; conforming toObservableObject; or asking whatobjectWillChangedoes and when it fires -> published-and-observableobject.md - Choosing
PassthroughSubjectvs.CurrentValueSubject; reading or writing.value; or callingsend(_:)/send(completion:)-> subjects.md - Applying
map/filter/removeDuplicates/debounce(for:scheduler:); or combining multiple publishers withcombineLatest/merge/zipand asking what shape the output takes -> operators-transforming-and-combining.md - Writing a publisher's output into a property with
assign(to:on:)or into a@Publishedproperty withassign(to:); diagnosing a retain-cycle risk; or calling.store(in:)-> assign-and-memory-management.md
Never load more than the contracts relevant to the specific question.
Stop Conditions
Stop and report if the requested topic has no matching Knowledge
Contract in knowledge/combine/ — do not guess or fall back to general
knowledge. Combine-to-async/await interop (Publisher.values,
AsyncPublisher/AsyncThrowingPublisher) is out of scope entirely --
do not fabricate a bridging pattern. Writing a custom Publisher or
Subscriber conformance is out of scope entirely -- route only to the
built-in publishers/operators these contracts cover. Backpressure and
Subscribers.Demand reasoning is out of scope entirely -- do not
fabricate demand-management guidance. Combine integration with
SwiftData or Core Data is out of scope entirely -- report the boundary
rather than answer from a persistence domain. Timer.publish/
NotificationCenter.publisher have no dedicated contract -- they may
appear only as an example inside another contract's Compliant Example,
never as their own routing target.