advanced-swift-patterns

Implements Swift property wrappers, custom collections, and Combine-to-async bridging protocols.

1|Updated Apr 5, 2026
One-click install
npx skills add https://github.com/piemonte/skills --skill advanced-swift-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: advanced-swift-patterns
Source: https://github.com/piemonte/skills/tree/main/advanced-swift-patterns
Command: npx skills add https://github.com/piemonte/skills --skill advanced-swift-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many Swift projects spend time writing repetitive boilerplate for property wrappers, interpolation, custom collection types, and bridging Combine to async/await, leading to error‑prone code and reduced performance.

Core Features & Use Cases

  • Property Wrappers: FastPublished, DefaultValue, CodableBox, UserDefault for efficient state handling.
  • Interpolation & Animation: Lerpable protocol, ExponentialDamper, AsymmetricExponentialDamper, Interpolator, async animation runner.
  • Custom Collections: NonEmpty, CountedSet, OrderedDictionary, Table for safe and expressive data structures.
  • Combine‑to‑Async Bridging: Publisher extensions for single‑value await, void completion, and async sequence conversion.
  • Advanced Async Utilities: AsyncBroadcastChannel, AsyncNotifier, DynamicJoinedAsyncNotifier, ChunkedSequence, parallel map/forEach.

Quick Start

Ask the skill to create a FastPublished property wrapper for a Boolean toggle.

Frequently Asked Questions about advanced-swift-patterns

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

FAQPage Schema
How do I bridge a Combine publisher to async/await in Swift?

To bridge Combine publishers to async/await in Swift, you can use extensions that enable single-value await, void completion, and async sequence conversion. This eliminates the need for custom boilerplate when consuming Combine streams concurrently.

What is the best way to implement safe custom collections like NonEmpty and OrderedDictionary in Swift?

Safe custom Swift collections like NonEmpty, CountedSet, and OrderedDictionary are implemented using generic protocols to enforce constraints at compile-time. This approach prevents invalid states and eliminates repetitive boilerplate validation code.

How do I create custom Swift property wrappers for efficient state handling?

Creating custom Swift property wrappers for state handling involves applying generic protocols to build types like FastPublished, DefaultValue, and UserDefault. This accelerates Swift state management by removing repetitive boilerplate code.

Can I use these advanced async patterns in server-side Swift projects?

Yes, these advanced async patterns apply directly to server-side Swift projects. The generic protocols, async broadcast channels, and custom collections operate without external dependencies, ensuring compatibility across iOS, macOS, and server environments.

How do I implement smooth value interpolation and animation in Swift without external libraries?

Smooth Swift value interpolation and animation are implemented using the Lerpable protocol and interpolators like ExponentialDamper. An async animation runner executes these interpolation sequences without requiring external dependencies.

Why does my parallel async map operation in Swift need a broadcast channel?

Parallel async map operations in Swift require an AsyncBroadcastChannel to safely manage concurrent task execution and synchronization. This utility allows multiple async sequences to broadcast and consume values dynamically without race conditions.