modern-swift

Explain non-concurrency Swift attributes, macros, and DSL features.

Updated Apr 7, 2026
One-click install
npx skills add https://github.com/pszypowicz/claude-skills --skill modern-swift-pszypowicz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-swift
Source: https://github.com/pszypowicz/claude-skills/tree/main/plugins/modern-swift/skills/modern-swift
Command: npx skills add https://github.com/pszypowicz/claude-skills --skill modern-swift-pszypowicz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Focused reference for Swift language features beyond concurrency to help developers avoid confusion around non-concurrency attributes, macros, and DSLs.

Core Features & Use Cases

  • Provides guidance on non-concurrency attributes (e.g., @available, @discardableResult, @frozen, @inlinable, @usableFromInline, @backDeployed), DSL support via @resultBuilder and macros, and property wrappers like @propertyWrapper.
  • Clarifies when to apply each feature, how they interact with library evolution and performance, and real-world usage scenarios such as API deprecation, renaming, and macro-driven code generation.
  • Use case: when designing or consuming Swift libraries or apps that leverage language features beyond concurrency to improve API stability and expressiveness.

Quick Start

Ask questions about non-concurrency Swift features (e.g., @available, @frozen, @resultBuilder) and I will provide concise definitions and examples.

Frequently Asked Questions about modern-swift

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

FAQPage Schema
How do I use Swift attributes like @frozen and @inlinable for library evolution?

Swift attributes like @frozen and @inlinable control binary stability and performance during library evolution. @frozen locks a struct's layout, while @inlinable exposes implementation across module boundaries, requiring careful coordination with @usableFromInline.

What is the difference between @usableFromInline and @inlinable in Swift?

@inlinable in Swift allows the compiler to inline code across modules, whereas @usableFromInline only marks internal declarations as accessible to inlinable code without exposing full source. They interact directly to manage API boundaries and library evolution.

How do I create a custom macro in Swift for code generation?

Creating a custom Swift macro involves defining code generation logic using Swift's macro system to reduce boilerplate. This DSL feature allows you to generate repetitive code structures at compile time, improving API expressiveness without runtime overhead.

When should I use @backDeployed for Swift API availability?

Use the @backDeployed Swift attribute when introducing new API functionality that needs to run on older OS versions. It deploys the implementation alongside your library, allowing clients to access new features before the platform natively supports them.

Does @resultBuilder work with property wrappers to build Swift DSLs?

@resultBuilder and @propertyWrapper serve distinct roles in Swift DSLs. @resultBuilder constructs complex nested data structures from imperative syntax, while @propertyWrapper encapsulates property access logic, and they can be combined for expressive APIs.

Why does my Swift code fail to use #Preview macros correctly?

Using #Preview macros incorrectly often stems from misunderstanding their integration with SwiftUI views and macro-driven code generation. You need explicit guidance on macro syntax and execution context to avoid misuses and ensure proper compile-time expansion.