combine-framework

Build reactive data flows with Combine publishers, subjects, and operators.

61|17|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/ahmed3elshaer/everything-claude-code-mobile --skill combine-framework
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: combine-framework
Source: https://github.com/ahmed3elshaer/everything-claude-code-mobile/tree/main/skills/combine-framework
Command: npx skills add https://github.com/ahmed3elshaer/everything-claude-code-mobile --skill combine-framework

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers implement and orchestrate reactive data flows on Apple platforms using the Combine framework, enabling clean, composable asynchronous code.

Core Features & Use Cases

  • Publishers & Subscribers: Create and connect publishers and subscribers to stream data and events.
  • Operators & Transformations: Use map, flatMap, scan, filter, merge, combineLatest, and zip to transform and synchronize streams.
  • SwiftUI Integration: Bind UI state with @Published properties and cancellables for responsive interfaces.
  • Error Handling & Memory: Implement retry, catch, replaceError, and proper memory management with AnyCancellable.

Quick Start

Create a Just publisher and subscribe to observe a value, then extend to a multi-step pipeline using map to transform data and sink to observe results.

Frequently Asked Questions about combine-framework

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build reactive data flows with Combine in Swift?

Combine enables reactive data flows by connecting publishers that emit values to subscribers that observe them. Create a publisher using Just or a Subject, apply operators like map or flatMap to transform data, then use sink to handle the results. This composes asynchronous streams without callbacks.

What's the difference between map and flatMap in Combine operators?

map transforms each value emitted by a publisher into a new value, while flatMap flattens nested publishers into a single stream. Use map for simple value transformation; use flatMap when your transformation returns a publisher itself, such as API calls or async operations.

How do I prevent memory leaks when using Combine subscribers?

Store subscriptions in AnyCancellable properties or a collection. When the AnyCancellable is deallocated, it automatically cancels the subscription, breaking retain cycles. This prevents publishers from holding references to subscribers indefinitely and keeps memory managed correctly.

Can I use Combine with SwiftUI state management?

Yes. Use @Published properties in ObservableObject classes to create publishers that SwiftUI observes automatically. Bind UI elements to these properties, and Combine handles the reactive updates when data changes, eliminating manual state synchronization.

How do I combine multiple publishers into a single stream?

Use merge to interleave values from multiple publishers, combineLatest to emit tuples whenever any publisher emits, or zip to pair emissions from each publisher. Choose based on whether you need all latest values, sequential pairs, or just any new value.

What operators should I use for error handling in Combine pipelines?

Use catch to handle errors and replace with a fallback publisher, retry to attempt the pipeline again on failure, or replaceError to substitute a default value. Combine lets you recover from errors without breaking the stream or crashing the app.