swift-coding-standards

Teaches Swift coding standards covering optionals, protocols, ARC, concurrency, and XCTest patterns.

4|Updated Mar 28, 2026
One-click install
npx skills add https://github.com/minexo79/coser-card-maker --skill swift-coding-standards-minexo79
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-coding-standards
Source: https://github.com/minexo79/coser-card-maker/tree/main/.kilo/skills/coding-standards/swift
Command: npx skills add https://github.com/minexo79/coser-card-maker --skill swift-coding-standards-minexo79

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Swift developers often struggle with inconsistent code style, retain cycles, unsafe optional handling, and unclear concurrency patterns. This Skill provides a structured, three-level reference for writing idiomatic Swift code following Apple's guidelines, protocol-oriented design, and modern async/await concurrency. ## Core Features & Use Cases - Progressive Learning Levels: Level 1 quick reference for optionals and naming conventions, Level 2 implementation guide covering protocols, ARC, error handling, and concurrency, and Level 3 deep-dive resources with advanced topics. - Production Templates: Ready-to-use MVVM ViewModel, protocol-oriented network service, and XCTest templates with mocks and async test patterns. - Tooling Configuration: A comprehensive SwiftLint configuration with 30+ opt-in rules and a setup script that scaffolds a complete Swift package with CI workflow. - Use Case: When starting a new iOS project, run the setup script to generate a Swift package with SwiftLint config, GitHub Actions CI, and template files, then follow the implementation guide to write protocol-oriented, memory-safe code. ## Quick Start Ask the AI to review your Swift code against these coding standards or to scaffold a new Swift project using the bundled setup script and templates.

Frequently Asked Questions about swift-coding-standards

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

FAQPage Schema
How do I avoid retain cycles in Swift closures?

Use capture lists with [weak self] in closures to break strong reference cycles, then call self optionally with self?.method(). Use [unowned self] only when self is guaranteed to outlive the closure, such as when the closure never escapes its owner.

When should I use struct vs class in Swift?

Use structs for simple data models and value semantics where independent copies are desired, such as User or Point types. Use classes when you need shared mutable state, object identity, or inheritance, such as a singleton NetworkManager.

How do I set up SwiftLint in an Xcode project?

Install SwiftLint via Homebrew with brew install swiftlint, then add a build phase script running swiftlint. This Skill includes a .swiftlint.yml configuration with 30+ opt-in rules, line length limits of 120, and custom rules for weak self and force unwrapping.

What is the difference between weak and unowned references?

Use weak when the referenced object can become nil during its lifetime, such as a delegate or parent view. Use unowned when the reference should never be nil after initialization, such as a CreditCard's customer, since accessing a deallocated unowned reference crashes.

How do I run async tasks in parallel with Swift concurrency?

Use withThrowingTaskGroup to execute multiple async operations concurrently. Add tasks with group.addTask for each operation, then collect results by iterating over the group, which runs all fetches in parallel instead of sequentially awaiting each one.

Does this Swift guide cover SwiftUI and testing?

Yes, it covers SwiftUI MVVM architecture with @StateObject, @Published, and MainActor patterns, plus XCTest testing including mock objects, async test patterns, UI testing, and performance tests. Templates for ViewModel and TestCase files are included.