{"enrichment":{"faq":[{"a":"Swift Idioms teaches you to prioritize value types (structs and enums) over classes, use guard let and optional binding instead of force unwrapping, and adopt protocol-oriented design to avoid deep inheritance hierarchies. The skill emphasizes naming conventions (camelCase for variables and methods), proper error handling with typed throws, and leveraging Swift's type system for safety. You'll learn patterns like defer for cleanup, Result types for async callbacks, and property wrappers for reducing boilerplate\u2014all with practical examples that show why each pattern matters.","q":"How do I write idiomatic Swift code that follows best practices?"},{"a":"Swift Idioms explains that structs and enums are value types\u2014they're copied when assigned or passed, making them safer for concurrent code and easier to reason about. Classes are reference types that share state, which can lead to unexpected mutations and threading issues. The skill shows when to choose each: use structs for data models and simple logic, classes only when you need reference semantics or inheritance. Understanding this distinction is foundational to writing safe, maintainable Swift.","q":"What's the difference between Swift value types and classes?"},{"a":"Swift Idioms covers safe optional handling patterns: guard let for early returns, if let for conditional binding, and the nil-coalescing operator (??) for defaults. Force unwrapping (!) crashes your app if the value is nil, so the skill teaches you to avoid it except in rare cases where you're absolutely certain a value exists. You'll learn when to use optional chaining, how to chain multiple optionals cleanly, and how to design APIs that minimize optional propagation\u2014keeping your code both safe and readable.","q":"How should I handle Swift optionals safely without force unwrapping?"},{"a":"Swift Idioms teaches protocol-oriented design as a way to define behavior through composition rather than deep class hierarchies. Protocols let you specify what a type must do without forcing a specific implementation path, and types can conform to multiple protocols. This approach is more flexible than inheritance, avoids the fragile base class problem, and works naturally with Swift's value types. The skill includes practical examples of designing with protocols, using protocol extensions for default behavior, and combining protocols with generics for powerful, reusable code.","q":"What is protocol-oriented design and how does it differ from inheritance?"},{"a":"Swift Idioms covers async/await as the modern way to write concurrent code without callback pyramids. You'll learn to mark functions async, use await to suspend execution, and structure work with Task and TaskGroup for dynamic concurrency. The skill explains actors for thread-safe state, Sendable for type-safe data sharing across isolation boundaries, and how to avoid common pitfalls like detached tasks that outlive their scope. Proper async/await usage prevents race conditions and makes concurrent logic much clearer.","q":"How do I use async/await and structured concurrency correctly in Swift?"},{"a":"Swift Idioms identifies key anti-patterns: force unwrapping optionals, using classes when structs fit better, ignoring compiler warnings, deep inheritance chains, and unsafe concurrency with shared mutable state. The skill warns against force casts, improper error handling, and detached tasks without proper cancellation. You'll learn why swiftlint and swift-format tools help catch these issues early, and how testing with XCTest and mock protocols catches logic errors before they reach production. Recognizing these pitfalls keeps your codebase maintainable and your apps stable.","q":"What anti-patterns and pitfalls should I avoid when coding in Swift?"}],"shadow_tags":["value-semantics","optional-safety","protocol-composition","structured-concurrency","type-safety","memory-management","error-propagation","testability-patterns","code-quality","swift-6-features"],"summary_rewrite":"This skill covers the core patterns that make Swift code safe and maintainable. You'll learn when to use structs over classes, how to handle optionals without crashes, design with protocols instead of inheritance, and leverage Swift's concurrency model. The guide includes practical examples of error handling, property wrappers, actors, and testing strategies\u2014plus anti-patterns to avoid."},"files":[{"bytes":8325,"path":".agents/skills/swift-idioms/SKILL.md","sha256":"495baa6c19752763ae0e59f0d5463e059ed86293ccfa8ca6d6a396bdebafec20","url":"https://skillfed.io/files/irahardianto/awesome-agv/swift-idioms/c119f494/SKILL.md"}],"id":"irahardianto/awesome-agv/swift-idioms","links":{"html":"https://skillfed.io/irahardianto/awesome-agv/swift-idioms","md":"https://skillfed.io/irahardianto/awesome-agv/swift-idioms.md","repo":"https://github.com/irahardianto/awesome-agv"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":48,"language":"JavaScript","last_updated":"2026-07-17","license":"MIT","name":"Swift Idioms","publisher":"irahardianto","stars":150},"relations":{"similar":[{"id":"irahardianto/awesome-agv/cpp-idioms"},{"id":"softspark/ai-toolkit/swift-patterns"},{"id":"dpearson2699/swift-ios-skills/swift-language"},{"id":"irahardianto/awesome-agv/testability-patterns"},{"id":"personamanagmentlayer/pcl/swift-expert"},{"id":"Jeffallan/claude-skills/swift-expert"},{"id":"miles990/claude-software-skills/swift"},{"id":"softspark/ai-toolkit/swift-rules"},{"id":"rshankras/claude-code-apple-skills/test-generator"},{"id":"travisjneuman/.claude/ios-development"}]},"slug":{"owner":"irahardianto","repo":"awesome-agv","skill":"swift-idioms"},"version":"c119f494"}
