swift-observation
15
总安装量
13
周安装量
#21884
全站排名
安装命令
npx skills add https://github.com/nonameplum/agent-skills --skill swift-observation
Agent 安装分布
claude-code
11
codex
9
opencode
8
gemini-cli
8
antigravity
7
cursor
7
Skill 文档
Observation
What to open
- Use
swift-observation/observation.mdfor full API details and examples. - Search within it for
@Observable,withObservationTracking,ObservationRegistrar,Observations, andObservationIgnored. - Use
swift-observation/observations_pre_iOS_26_backport.mdfor availability notes and backport discussion. - Use
swift-observation/Observation/source files to inspect theObservationsimplementation and any supporting runtime pieces when evaluating backport feasibility.
Workflow
- Prefer
@Observableto make models observable; do not conform toObservablemanually. - Read properties inside
withObservationTrackingto define the dependency set. - Use
ObservationIgnoredfor properties that should not trigger updates. - Use
Observationswhen you need async change streams.
SwiftUI usage
- For SwiftUI, treat
@Observablemodels as the source of truth and let the view read the properties it needs. - Use
withObservationTrackingfor non-SwiftUI rendering or custom observers.
Availability and backport notes
Observationsis available on iOS 26+; plan for fallbacks on earlier OSes.- For pre-iOS 26 support, consider community backports or vendor forks; see
swift-observation/observations_pre_iOS_26_backport.mdfor options and caveats.