Skip to content
Back to skills

Ios State Management

ASecurity

Standards for Combine, Observation, and Reactive Programming. Use when managing state with Combine, @Observable, or reactive patterns in iOS. (triggers: **/*.swift, Observable, @Published, PassthroughSubject, @Observable, @Namespace)

  • 67 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 10, 2026
developmentswiftreactperformance

Security analysis

A100/100

Scanned November 10, 2026

npx -y skills add ComeOnOliver/skillshub --skill ios-state-management --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ios State Management?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ios State Management
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/comeonoliver-ios-state-management/badge)](https://www.skillsdirectory.com/skills/comeonoliver-ios-state-management)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ios-state-management
description: 'Standards for Combine, Observation, and Reactive Programming. Use when managing state with Combine, @Observable, or reactive patterns in iOS. (triggers: **/*.swift, Observable, @Published, PassthroughSubject, @Observable, @Namespace)'
---

# iOS State Management Standards

## **Priority: P0**

## Implementation Guidelines

### Combine (Reactive States)

- **Publishers**: Use **`@Published`** for standard state in ViewModels. Use **`PassthroughSubject`** for one-time navigation or alert events.
- **Memory Management**: Store subscriptions in a **`Set<AnyCancellable>`**. Use **`.store(in: &cancellables)`** to prevent memory leaks and ensure they are cleared on deinit.
- **Operators**: Use specific operators like **`.debounce`**, **`.filter`**, **`.map`**, and **`.flatMap`** to handle complex input streams.
- **Schedulers**: Always ensure UI property updates occur on the main thread using **`@MainActor`** or **`.receive(on: DispatchQueue.main)`**.

### Observation Framework (iOS 17+)

- **`@Observable`**: Use the **`@Observable`** macro for modern, high-performance observation in **SwiftUI**.
- **State Properties**: In SwiftUI views, use **`@Bindable`** for two-way bindings with `@Observable` objects.
- **Namespaces**: Use **`@Namespace`** for match-geometry animations and coordinate space tracking.

### Unidirectional Data Flow (UDF)

- **Input/Output**: ViewModels should expose an **`Input`** enum (events) and **`Output`** struct (state) to enforce a clear data direction.
- **ViewState**: Prefer a single, exhaustive **`ViewState`** enum (e.g., `.loading`, `.success(data)`, `.error(failure)`).

## Anti-Patterns

- **No uncleared subscriptions**: Always use .store(in: &cancellables).
- **No UI updates on background**: Use .receive(on: .main).
- **No manual objectWillChange**: Use @Published or @Observable.

## References

- [Combine & Observation Setup](references/implementation.md)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.