skills/swift_combine/SKILL.md
Swift Combine framework for reactive programming, handling asynchronous events with publishers, subscribers, and operators.
npx skillsauth add swiftzilla/skills swift_combineInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill covers Apple's Combine framework for reactive programming and handling asynchronous events.
Combine is a declarative Swift API for processing values over time. It provides a unified approach to handling asynchronous events, user interface updates, and data streams.
import Combine
// Published property
@Published var username: String = ""
// CurrentValueSubject
let subject = CurrentValueSubject<String, Never>("initial")
// PassthroughSubject
let passthrough = PassthroughSubject<Int, Never>()
// Just publisher
let just = Just("value")
// Future publisher
let future = Future<String, Error> { promise in
promise(.success("result"))
}
// Sink
let cancellable = publisher.sink(
receiveCompletion: { completion in
switch completion {
case .finished:
print("Completed")
case .failure(let error):
print("Error: \(error)")
}
},
receiveValue: { value in
print("Value: \(value)")
}
)
// Assign
let cancellable = publisher
.assign(to: \.text, on: label)
private var cancellables = Set<AnyCancellable>()
publisher
.sink { value in
print(value)
}
.store(in: &cancellables)
publisher
.filter { $0 > 0 }
.map { $0 * 2 }
.debounce(for: .seconds(0.5), scheduler: RunLoop.main)
.removeDuplicates()
.sink { value in
print(value)
}
| Use Case | Combine | Async/Await | |----------|---------|-------------| | Event streams | ✅ Excellent | ⚠️ Complex | | UI bindings | ✅ Perfect | ⚠️ Verbose | | Chaining operations | ✅ Great | ✅ Good | | Simple async calls | ⚠️ Overkill | ✅ Simple | | Error handling | ✅ Rich | ✅ Good |
Visit https://swiftzilla.dev for comprehensive Combine documentation.
tools
Use this skill when you need expert Swift/iOS architectural guidance, semantic codebase analysis, or PR impact reviews. It provides a senior mentor layer for Swift (SwiftUI, UIKit, Combine, Concurrency) and a semantic engine to query local code context. Trigger this skill to: 1. Validate architectural patterns before implementation using 'ask'. 2. Find and map local code dependencies using 'context'. 3. Analyze the risk and blast radius of a PR using 'review'. 4. Generate system overviews for onboarding using 'onboard'. 5. Troubleshoot runtime crashes with semantic LLDB tools using 'debug'. Activate even if specific keywords are missing but the intent is improving Swift code quality or understanding project structure.
development
Swift Testing framework for unit tests, integration tests, and async testing with modern syntax.
development
SwiftUI framework concepts including property wrappers, state management, and reactive UI patterns.
development
Swift style guidelines covering naming conventions, code organization, and best practices for writing idiomatic Swift code.