pfw-sharing

Share and persist values across Swift components using the Sharing library.

16|2|Updated Mar 29, 2018
One-click install
npx skills add https://github.com/khoi/dotfiles --skill pfw-sharing-khoi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pfw-sharing
Source: https://github.com/khoi/dotfiles/tree/main/chezmoi/dot_pfw/skills/sharing
Command: npx skills add https://github.com/khoi/dotfiles --skill pfw-sharing-khoi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Share and persist values across your application with the Sharing library, enabling centralized state management and simpler data flow across components.

Core Features & Use Cases

  • Shared state via @Shared wrappers enabling storage with appStorage and fileStorage.
  • Type-safe defaults, bindings, and easy UI integration with SwiftUI.
  • Use Case: Persist user preferences and share data between views and models.

Quick Start

Add the Sharing package to your project, import Sharing, and start declaring @Shared properties in your models.

Frequently Asked Questions about pfw-sharing

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

FAQPage Schema
How do I share and persist values across iOS app components?

To share and persist values across iOS app components, use the Sharing library with @Shared wrappers. This enables centralized state management and allows data persistence using storage strategies like appStorage or fileStorage.

What is the best way to persist user preferences in a SwiftUI app?

Persisting user preferences in a SwiftUI app is best handled using @Shared with appStorage. This provides type-safe defaults and direct UI integration, simplifying data flow between your views and models.

How does the Swift Sharing library work for centralized state management?

The Swift Sharing library works for centralized state management by using @Shared property wrappers. This allows you to declare shared values that sync across components, ensuring data consistency without complex manual bindings.

Can I use fileStorage with @Shared for Swift data persistence?

Yes, you can use fileStorage with @Shared for Swift data persistence. The Sharing library supports multiple storage strategies, allowing you to choose between appStorage for preferences and fileStorage for larger datasets.

Do I need to add a dependency to use @Shared in my Swift app?

Yes, you need to add the Sharing package dependency to use @Shared in your Swift app. After adding the package, import Sharing into your files to start declaring shared properties in your models.