swift-case-paths

Expose Swift enum cases as first-class, path-like values.

16|2|Updated Jan 1, 2026
One-click install
npx skills add https://github.com/nonameplum/agent-skills --skill swift-case-paths
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: swift-case-paths
Source: https://github.com/nonameplum/agent-skills/tree/main/swift-case-paths
Command: npx skills add https://github.com/nonameplum/agent-skills --skill swift-case-paths

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Case-based logic in Swift often requires verbose pattern matching and manual unwrapping of associated values. This skill eliminates boilerplate by exposing enum cases as first-class, path-like values, enabling concise and type-safe access.

Core Features & Use Cases

  • Core primitives for constructing and composing enum case paths
  • Macro support (CasePathable) to derive pathable behavior
  • Use case: route based on enum cases with associated values in a Swift UI or data layer

Quick Start

  • Import the CasePaths library and start using CasePathable in your enums.
  • Define case paths for common enum cases and compose them to traverse nested values.
  • Build and run to verify type-safe enum path extraction and routing.

Frequently Asked Questions about swift-case-paths

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

FAQPage Schema
How do I reduce boilerplate when pattern matching Swift enums with associated values?▼

You can reduce Swift enum pattern matching boilerplate by exposing enum cases as first-class, path-like values. This approach enables concise, type-safe extraction and routing without manual unwrapping for each case.

Can I route Swift UI navigation based on enum cases with associated values?▼

Yes, you can route Swift UI or data layer navigation based on enum cases with associated values. By defining and composing case paths, you achieve type-safe enum path extraction and dispatch without verbose switch statements.

What is an enum case path in Swift and when do I need it?▼

An enum case path is a first-class, key-path style value that exposes a specific enum case for extraction or modification. You need it when case-based logic requires concise routing, dispatch, or traversal of nested values.

Does this approach work with nested Swift enums and their associated values?▼

Yes, this approach works with nested Swift enums by allowing you to compose case paths. You can define paths for common enum cases and traverse nested associated values type-safely throughout your project.