Agent skill

iOS Patterns

by hanamizuki in hanamizuki/solopreneur

A skill your agent uses when building iOS/macOS apps with SwiftUI — covers localization (String Catalogs), date/time formatting, JSON date decoding, Previews, state management, sheet/navigation…

MITAuto-check: notesFrontend & Design

Install iOS Patterns

skills CLI
$ npx skills add hanamizuki/solopreneur --skill ios-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install hanamizuki/solopreneur ios-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/hanamizuki/solopreneur.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/ios-dev/ios-patterns .claude/skills/ios-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ios-patterns
GitHub stars
152
Token cost
~2.3k tokens
SKILL.md length
470 words
Files
3 (incl. references)
Skills in repo
31
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when building iOS/macOS apps with SwiftUI — covers localization (String Catalogs), date/time formatting, JSON date decoding, Previews, state management, sheet/navigation…

  • Works in 10 steps: Localization (i18n) → Date & Time Localization → ISO8601 Date Parsing (JSON) → …
  • Building iOS/macOS apps with SwiftUI — covers localization (String Catalogs)
  • SKILL.md covers 1. Localization (i18n), 2. Date & Time Localization, 3. ISO8601 Date Parsing (JSON) and 4. SwiftUI Preview, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

iOS Patterns is an agent skill from hanamizuki/solopreneur. Use when building iOS/macOS apps with SwiftUI — covers localization (String Catalogs), date/time formatting, JSON date decoding, Previews, state management, sheet/navigation, list spacing, and animation patterns.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/i18n-guide.md` and `references/swiftui-preview-guide.md`).

It sits in Frontend & Design, covering Internationalization, iOS development and State management. It works with iOS, SwiftUI and macOS. The repository describes itself as: Skills and agents for solopreneurs — ship, review, debug, and think through problems with AI. The licence is MIT.

When your agent uses it

  • Building iOS/macOS apps with SwiftUI — covers localization (String Catalogs)
  • Date/time formatting
  • JSON date decoding
  • State management

Example prompts

  • “/ios-patterns”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash, Grep, Glob

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Localization (i18n)
  2. Date & Time Localization
  3. ISO8601 Date Parsing (JSON)
  4. SwiftUI Preview
  5. State Management
  6. Modifier Order
  7. Sheet & Navigation
  8. List Section Spacing (iOS 17+)
  9. Expandable Content Animation
  10. Keyboard Done Button

What it can do on your machine

Read from SKILL.md and the folder at commit f43f001. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash
    • Grep
    • Glob

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are swift).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

iOS Patterns loads about 2.3k tokens when it runs, and up to ~3.8k if it reads all its reference files. Until then it costs about 56 tokens; SKILL.md has 470 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~56
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Bash, Grep, Glob

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from hanamizuki/solopreneur at commit f43f001, republished under its MIT licence (© hanamizuki). 470 words, ~2,329 tokens.

Download SKILL.mdSave it as .claude/skills/ios-patterns/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
ios-patterns
description
Use when building iOS/macOS apps with SwiftUI — covers localization (String Catalogs), date/time formatting, JSON date decoding, Previews, state management, sheet/navigation, list spacing, and animation patterns.
allowed-tools
Read, Write, Edit, Bash, Grep, Glob

iOS SwiftUI Patterns

A collection of SwiftUI conventions that keep code consistent, localizable, and resilient to edge cases. Apply these patterns to any iOS/macOS SwiftUI project. See references/ for in-depth guides.

1. Localization (i18n)

Use String Catalog (.xcstrings) — not Localizable.strings — for all user-facing text. Reference: references/i18n-guide.md.

swift
// In a View: LocalizedStringKey is inferred
Text("welcome_message")
Text("greeting \(username)")

// In a ViewModel or non-View context, use String(localized:)
let message = String(localized: "error_network")
let formatted = String(localized: "items_count \(count)")
Key naming

Use snake_case, grouped by feature: home_title, settings_notification_enabled, error_network_unavailable. Embed parameters in the key: "profile_welcome \(name)", "cart_items_count \(count)".

Avoid
swift
Text("Welcome")                                    // ❌ hard-coded
let title: LocalizedStringKey = "welcome"          // ❌ only works in Views
let title = String(localized: "welcome")           // ✅ works anywhere

2. Date & Time Localization

Never hard-code format strings like "M/d" or "MM/dd". Different locales order date components differently (US: 12/13, AU/UK: 13/12, TW: 12/13). Use setLocalizedDateFormatFromTemplate so the system picks the correct order.

Centralize formatting behind one utility (e.g. LocalizedDateFormatter) that vends cached DateFormatters keyed by template:

swift
enum LocalizedDateStyle {
    case monthDayNumeric         // "Md"       → 12/13 or 13/12
    case monthDayAbbreviated     // "MMMd"     → Dec 13 / 13 Dec / 12月13日
    case yearMonthDayAbbreviated // "yMMMd"    → Dec 13, 2025
    case yearMonthDayFull        // "yMMMMd"   → December 13, 2025
    // ...
}

let text = LocalizedDateFormatter.string(from: date, style: .monthDayAbbreviated)
Rules
  • Preserve script variants when constructing Locale (e.g. zh-Hant vs zh-Hans) so Traditional and Simplified Chinese users see the right format.
  • DateFormatter is not thread-safe — shared cached formatters are main-thread only. Background threads must create their own instance.
  • Storage/API/logs use fixed ISO formats (yyyy-MM-dd, HH:mm) — not localized.

3. ISO8601 Date Parsing (JSON)

JSONDecoder.DateDecodingStrategy.iso8601 does not accept fractional seconds. Backends (PostgreSQL timestamptz, Supabase, Fider, etc.) may return any of:

2025-12-08T10:00:00Z           ✅ supported
2025-12-08T10:00:00.123Z       ❌ fails
2025-12-08T10:00:00.123456Z    ❌ fails

The bug is data-dependent and intermittent — local fixtures usually don't reproduce it. Always install a flexible decoder:

swift
extension JSONDecoder {
    static var withFlexibleDateDecoding: JSONDecoder {
        let decoder = JSONDecoder()
        decoder.dateDecodingStrategy = .custom { decoder in
            let container = try decoder.singleValueContainer()
            let s = try container.decode(String.self)
            let f = ISO8601DateFormatter()

            f.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
            if let d = f.date(from: s) { return d }

            f.formatOptions = [.withInternetDateTime]
            if let d = f.date(from: s) { return d }

            // Normalize PostgreSQL "yyyy-MM-dd HH:mm:ss.SSSSSS" → ISO8601
            let normalized = s
                .replacingOccurrences(of: " ", with: "T")
                .replacingOccurrences(of: #"(\.\d{3})\d+"#, with: "\$1",
                                      options: .regularExpression)
            f.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
            if let d = f.date(from: normalized) { return d }

            throw DecodingError.dataCorruptedError(
                in: container,
                debugDescription: "Unrecognized date format: \(s)")
        }
        return decoder
    }
}

4. SwiftUI Preview

Every View ships with Previews. Reference: references/swiftui-preview-guide.md.

swift
#Preview("Default")       { MyView() }
#Preview("With Data")     { MyView(items: .mock) }
#Preview("Empty State")   { MyView(items: []) }

#Preview("Dark Mode") {
    MyView().preferredColorScheme(.dark)
}

#Preview("Large Text") {
    MyView().environment(\.dynamicTypeSize, .accessibility3)
}

#Preview("繁體中文") {
    MyView().environment(\.locale, .init(identifier: "zh-Hant"))
}

Provide mock static values on models so Previews stay trivial:

swift
extension User {
    static let mock = User(id: UUID(), name: "Alice", email: "a@example.com")
    static let mockList: [User] = [.mock, /* ... */]
}

5. State Management

swift
@State private var isExpanded = false            // local view state
@Binding var selectedItem: Item?                 // mutable state from parent
@StateObject private var vm = MyViewModel()      // owner of a VM
@ObservedObject var vm: MyViewModel              // passed-in VM
@Environment(\.dismiss) private var dismiss
ViewModel template
swift
@MainActor
final class MyViewModel: ObservableObject {
    @Published private(set) var items: [Item] = []
    @Published private(set) var isLoading = false
    @Published var error: Error?

    func loadItems() async {
        isLoading = true
        defer { isLoading = false }
        do { items = try await service.fetchItems() }
        catch { self.error = error }
    }
}

6. Modifier Order

Apply modifiers in a consistent order: content style → size → padding → background → shape → shadow → gesture.

swift
Text("Hello")
    .font(.headline)
    .frame(maxWidth: .infinity)
    .padding()
    .background(.blue)
    .cornerRadius(8)
    .shadow(radius: 4)
    .onTapGesture { }

7. Sheet & Navigation

Pick the sheet configuration by purpose:

KindDetentsDrag indicatorDismissable by swipe
Info (short explanation)[.fraction(0.3–0.5)]visibleyes
Content (detail view)[.medium, .large]visibleyes
Management (data list)[.medium, .large]visibleyes
Edit (form with unsaved input)default or .largehiddenno — .interactiveDismissDisabled()
swift
// Edit sheet — must commit via explicit Save/Cancel
.sheet(isPresented: $showEdit) {
    EditFormView(onSave: save, onCancel: { showEdit = false })
        .interactiveDismissDisabled()
}
Show full SKILL.md (183 more words)Show less
NavigationStack
  • Tab roots with multi-level drill-down: use NavigationStack.
  • Single-page tabs that delegate subflows to sheets: no NavigationStack.
  • Inside a sheet: usually no NavigationStack; prefer multiple sheets over nested sheet navigation. Avoid stacking sheets more than 2 levels deep.

8. List Section Spacing (iOS 17+)

When a Section has a footer, set .listSectionSpacing(.custom(24)) so the small footer text isn't crammed against the next section:

swift
Section {
    TextField("name", text: $name)
} header: {
    Text("basic_info")
} footer: {
    Text("basic_info_hint")
}
.listSectionSpacing(.custom(24))

Individual Section settings override a Form-level .listSectionSpacing(...).

9. Expandable Content Animation

Inside Form/List, conditionally rendering content with if isExpanded { ... } causes the whole list to reflow and the content to slide in from above, overlapping the first row.

Fix: always render; toggle frame(maxHeight:) and opacity:

swift
VStack(alignment: .leading, spacing: 8) {
    Button { isExpanded.toggle() } label: {
        HStack { Text("title"); Spacer(); Text(isExpanded ? "less" : "more") }
    }
    .buttonStyle(.plain)

    Text("expanded_body_copy")
        .fixedSize(horizontal: false, vertical: true)
        .frame(maxHeight: isExpanded ? nil : 0, alignment: .top)
        .opacity(isExpanded ? 1 : 0)
        .clipped()
}
.animation(.easeInOut(duration: 0.15), value: isExpanded)

Keep .animation(_:value:) on the container — don't wrap the toggle in withAnimation. For simple disclosure UI, prefer the built-in DisclosureGroup.

10. Keyboard Done Button

All keyboard-input screens should share one "Done" affordance. Implement it once as a ViewModifier using safeAreaInset(edge: .bottom) — it is more reliable than .toolbar(placement: .keyboard), which has a known iOS 18 bug where the toolbar fails to appear on first focus.

swift
// ✅ Apply to the outermost container (NavigationStack / Form)
NavigationStack {
    Form {
        TextField("name", text: $name)
        TextField("amount", value: $amount, formatter: .decimal)
    }
}
.keyboardDoneButton()

// ✅ Run extra logic on dismiss
.keyboardDoneButton(onDone: { focusedField = nil })

References

  • references/i18n-guide.md — String Catalog workflow, pluralization, testing
  • references/swiftui-preview-guide.md — Preview patterns, providers, device matrices

© hanamizuki, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in skills/ios-dev/ios-patterns of hanamizuki/solopreneur.

  • SKILL.md
  • references/i18n-guide.md
  • references/swiftui-preview-guide.md

Open the folder on GitHubat commit f43f001

Compare with similar skills

iOS Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

iOS Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
iOS Patterns this skillhanamizuki/solopreneur152—~2.3kAutomated safety check: NotesMIT
Localization Setuprshankras/claude-code-apple-skills783—~1.4kAutomated safety check: NotesMIT
Swiftui Patternsaffaan-m/ECC275k4 repos~1.8kAutomated safety check: PassMIT
Xcstrings ManagerEslzzyl/Pixiv-SwiftUI111—~482Automated safety check: PassAGPL-3.0
Swiftui Expert Skillsupabitapp/supaterm172—~1.5kAutomated safety check: PassCustom licence
Hig Project Contextraintree-technology/hig-doctor1435 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • Localization Setup

    rshankras/claude-code-apple-skills

    Generate internationalization (i18n) infrastructure for multi-language support in iOS/macOS apps.

    783 GitHub stars~1.4k tokensUpdated 2 mo ago
    Frontend & DesignAuto-check: notes
  • Swiftui Patterns

    affaan-m/ECC

    SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

    275k GitHub starsUsed in 4 repos~1.8k tokens
    MobileAuto-check passed
  • Xcstrings Manager

    Eslzzyl/Pixiv-SwiftUI

    Manage Xcode String Catalog (.xcstrings) localization files through a command-line interface.

    111 GitHub stars~482 tokensUpdated yesterday
    MobileAuto-check passed
  • Swiftui Expert Skill

    supabitapp/supaterm

    Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, macOS-specific APIs, and iOS 26+ Liquid Glass adoption.

    172 GitHub stars~1.5k tokensUpdated 14 days ago
    MobileAuto-check passed
  • Hig Project Context

    raintree-technology/hig-doctor

    Create or update a shared Apple design context document that other HIG skills use to tailor guidance.

    143 GitHub starsUsed in 5 repos~1.2k tokens
    MobileAuto-check passed
  • Hig Components Content

    raintree-technology/hig-doctor

    Apple Human Interface Guidelines for content display components.

    143 GitHub starsUsed in 5 repos~1.3k tokens
    MobileAuto-check passed

More from hanamizuki/solopreneur

All 31 skills in this repo
  • Preview

    hanamizuki/solopreneur

    Create an interactive HTML preview of any proposal, plan, idea, doc, brief, or spec and land it in the browsable local Preview Library by default (opens under file:// with a catalog sidebar and…

    152 GitHub stars~5.2k tokensUpdated 12 days ago
    Auto-check passed
  • Linkedin Growth

    hanamizuki/solopreneur

    LinkedIn organic growth consultant — diagnoses profiles, discusses goals, and co-creates a personalized 90-day growth plan.

    152 GitHub stars~3.7k tokensUpdated 12 days ago
    Auto-check passed
  • Perspective

    hanamizuki/solopreneur

    Switch perspectives to think through problems using the mental models of ten iconic thinkers: Elon Musk, Richard Feynman, Charlie Munger, Naval Ravikant, Steve Jobs, Nassim Taleb, Ilya Sutskever…

    152 GitHub stars~971 tokensUpdated 12 days ago
    Auto-check passed
  • Slide Design

    hanamizuki/solopreneur

    Create brand-aware presentations using frontend-slides or reveal.js.

    152 GitHub stars~3.9k tokensUpdated 12 days ago
    Auto-check passed
  • X Growth

    hanamizuki/solopreneur

    X/Twitter growth consultant — diagnoses profiles, discusses goals, and co-creates a personalized growth plan.

    152 GitHub stars~3.8k tokensUpdated 12 days ago
    Auto-check passed
  • X Writing

    hanamizuki/solopreneur

    X/Twitter writing coach — helps you write single tweets, threads, and long-form posts.

    152 GitHub stars~2.3k tokensUpdated 12 days ago
    Auto-check passed

Works with

Questions about iOS Patterns

What does iOS Patterns do?

A skill your agent uses when building iOS/macOS apps with SwiftUI — covers localization (String Catalogs), date/time formatting, JSON date decoding, Previews, state management, sheet/navigation…. iOS Patterns is an agent skill from hanamizuki/solopreneur. Use when building iOS/macOS apps with SwiftUI — covers localization (String Catalogs), date/time formatting, JSON date decoding, Previews, state management, sheet/navigation, list spacing, and animation patterns.

When should I use iOS Patterns?

iOS Patterns fits situations like: building iOS/macOS apps with SwiftUI — covers localization (String Catalogs); date/time formatting; JSON date decoding; state management.

How do I install iOS Patterns in Claude Code?

Run `npx skills add hanamizuki/solopreneur --skill ios-patterns -a claude-code`. Or copy the skill folder (skills/ios-dev/ios-patterns in hanamizuki/solopreneur) into .claude/skills/ios-patterns in your project. Claude Code loads it when a task matches its description.

How do I install iOS Patterns in Codex?

Run `npx skills add hanamizuki/solopreneur --skill ios-patterns -a codex`. Or copy the skill folder (skills/ios-dev/ios-patterns in hanamizuki/solopreneur) into .agents/skills/ios-patterns in your project. Codex loads it when a task matches its description.

Can I use iOS Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add hanamizuki/solopreneur --skill ios-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ios-patterns, .gemini/skills/ios-patterns, .github/skills/ios-patterns and .opencode/skills/ios-patterns in your project.

What does iOS Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: iOS Patterns is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash, Grep, Glob.

Does iOS Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is iOS Patterns safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does iOS Patterns use?

iOS Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does iOS Patterns use?

About 2.3k tokens (SKILL.md is roughly 9.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.5k tokens, read only when the agent opens those files.

What are the alternatives to iOS Patterns?

Skills that share tags, products or a category with iOS Patterns: Localization Setup (rshankras/claude-code-apple-skills, 783 stars), Swiftui Patterns (affaan-m/ECC, 275k stars), Xcstrings Manager (Eslzzyl/Pixiv-SwiftUI, 111 stars) and Swiftui Expert Skill (supabitapp/supaterm, 172 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains iOS Patterns?

hanamizuki (a GitHub user) maintains it in hanamizuki/solopreneur, which has 152 GitHub stars. The repository holds 31 skills in this directory. The repository was last updated on September 26, 2026.

Source: hanamizuki/solopreneur on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.