home / skills / fusengine / agents / swift-core

This skill helps you implement Swift 6 concurrency, architecture, testing, i18n, and performance optimizations across Apple platforms with best practices.

npx playbooks add skill fusengine/agents --skill swift-core

Review the files below or copy the command above to add this skill to your agents.

Files (6)
SKILL.md
2.9 KB
---
name: swift-core
description: Swift 6 fundamentals for all Apple platforms. Use when implementing concurrency, architecture, testing, i18n, or performance optimization across iOS, macOS, iPadOS, watchOS, visionOS.
versions:
  swift: 6.2
  ios: 26
user-invocable: false
references: references/concurrency.md, references/architecture.md, references/testing.md, references/i18n.md, references/performance.md
related-skills: swiftui-core, solid-swift, ios, macos, ipados, watchos, visionos
---

# Swift Core

Swift 6 fundamentals shared across all Apple platforms.

## Agent Workflow (MANDATORY)

Before ANY implementation, use `TeamCreate` to spawn 3 agents:

1. **fuse-ai-pilot:explore-codebase** - Analyze existing Swift patterns
2. **fuse-ai-pilot:research-expert** - Verify latest Swift 6 docs via Context7/Exa
3. **mcp__apple-docs__search_apple_docs** - Check Swift concurrency patterns

After implementation, run **fuse-ai-pilot:sniper** for validation.

---

## Overview

### When to Use

- Implementing async/await, actors, Sendable
- Designing app architecture (MVVM, Clean Architecture)
- Writing async tests with XCTest
- Localizing with String Catalogs
- Profiling with Instruments

### Why Swift Core

| Feature | Benefit |
|---------|---------|
| Actors | Thread-safe shared state without locks |
| @Observable | Simple reactive state (replaces ObservableObject) |
| String Catalogs | Automatic localization with Xcode 15+ |
| Instruments | Built-in performance profiling |

---

## Key Concepts

### Concurrency (Swift 6)
Modern async/await with strict concurrency checking. Actors provide thread-safe state, Sendable marks safe types.

### Architecture
MVVM with @Observable is the recommended pattern. Clean Architecture for complex apps with domain separation.

### Testing
XCTest with native async/await support. No need for expectations with async tests.

### Internationalization
String Catalogs are mandatory. All user-facing text must be localized.

### Performance
Profile with Instruments. Use lazy loading, avoid heavy work in view body.

---

## Reference Guide

| Need | Reference |
|------|-----------|
| Async/await, actors, Sendable | [concurrency.md](references/concurrency.md) |
| MVVM, Clean Architecture, DI | [architecture.md](references/architecture.md) |
| XCTest, async tests, mocking | [testing.md](references/testing.md) |
| String Catalogs, localization | [i18n.md](references/i18n.md) |
| Instruments, optimization | [performance.md](references/performance.md) |

---

## Best Practices

1. **Actors for shared state** - Prefer actors over classes with locks
2. **@Observable over ObservableObject** - Simpler, better performance
3. **Structured concurrency** - async/await, no completion handlers
4. **String Catalogs** - ALL user-facing text must be localized
5. **Profile in Release** - Always profile with `-O` optimization
6. **Value types** - Prefer structs over classes

Overview

This skill captures Swift 6 fundamentals for all Apple platforms, focusing on concurrency, architecture, testing, internationalization, and performance. It provides practical guidance and a reproducible agent workflow to validate implementations across iOS, macOS, iPadOS, watchOS, and visionOS.

How this skill works

Before any implementation spawn three agents using TeamCreate: fuse-ai-pilot:explore-codebase, fuse-ai-pilot:research-expert, and mcp__apple-docs__search_apple_docs to analyze patterns, verify Swift 6 changes, and check concurrency guidance. Follow the recommended patterns (actors, @Observable, string catalogs) during development and run fuse-ai-pilot:sniper after implementation for automated validation and checks.

When to use it

  • Implementing async/await, actors, and Sendable semantics in app code
  • Designing app architecture (MVVM, Clean Architecture) across Apple platforms
  • Writing and running async XCTest unit and integration tests
  • Localizing UI with Xcode String Catalogs for all user-facing text
  • Profiling and optimizing runtime performance using Instruments

Best practices

  • Prefer actors for shared mutable state instead of locks or synchronized classes
  • Adopt @Observable for view-model state to simplify reactive patterns and improve performance
  • Use structured concurrency (async/await) throughout; avoid completion-handler patterns
  • Localize all user-facing strings with String Catalogs; enforce during reviews
  • Profile release builds (-O) with Instruments and optimize hotspots before shipping
  • Favor value types (structs) over classes when appropriate to reduce reference-cycle costs

Example use cases

  • Refactoring a legacy networking layer to async/await and marking types Sendable where needed
  • Implementing an MVVM flow with @Observable view models and dependency injection for testability
  • Converting unit tests to async XCTest without expectations and taking advantage of structured concurrency
  • Replacing NSLocalizedString usage with Xcode String Catalogs and verifying translations
  • Profiling a slow view on a device with Instruments and applying lazy loading to eliminate main-thread work

FAQ

Which agents must I run before implementing changes?

Spawn three agents via TeamCreate: fuse-ai-pilot:explore-codebase, fuse-ai-pilot:research-expert, and mcp__apple-docs__search_apple_docs to analyze the codebase, validate Swift 6 docs, and check concurrency patterns.

When should I run validation after implementation?

Run fuse-ai-pilot:sniper after implementation to validate patterns, concurrency safety, and localization adherence.