ios-swiftui

Guides SwiftUI and MVVM architecture for modern iOS app development.

6|Updated May 18, 2026
One-click install
npx skills add https://github.com/mokhtarabadi/cognitive-lead-hq --skill ios-swiftui-mokhtarabadi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ios-swiftui
Source: https://github.com/mokhtarabadi/cognitive-lead-hq/tree/main/skill-templates/ios-swiftui
Command: npx skills add https://github.com/mokhtarabadi/cognitive-lead-hq --skill ios-swiftui-mokhtarabadi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building iOS apps with AI assistance often produces inconsistent code mixing UIKit and SwiftUI, callback-based networking, and ambiguous date handling. This Skill enforces a strict, token-efficient SwiftUI architecture so generated code stays consistent, testable, and modern. ## Core Features & Use Cases - SwiftUI-First Architecture: Mandates declarative SwiftUI over UIKit, with a defined project structure separating App, Core, Models, Views, and ViewModels. - Modern Concurrency & State: Enforces async/await networking, @Observable state management, and @MainActor ViewModels under Swift 6 concurrency checking. - DateTime Governance: Defines UTC-at-rest storage, clock injection via a ClockProvider protocol, and ISO-8601/epoch API boundaries to prevent timezone bugs. - Use Case: When scaffolding a new iOS feature, apply this Skill so the AI generates an MVVM screen with an @Observable ViewModel, async/await networking, and XCTest-ready dependency injection. ## Quick Start Apply the ios-swiftui skill and generate a new SwiftUI screen with its ViewModel following MVVM and async/await conventions.

Frequently Asked Questions about ios-swiftui

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

FAQPage Schema
How do I structure a SwiftUI project with MVVM?▼

Organize the project into App, Core, Models, Views, and ViewModels directories. Views handle only layout and state binding, while ViewModels contain business logic and are owned by views via @StateObject or the @Observable macro.

How to handle networking in SwiftUI with async await?▼

Use URLSession.shared.data(from:) with async/await instead of completion handlers. Mark ViewModels with @MainActor so UI updates happen on the main thread, and inject mock network clients via protocols for testing.

Should I use @State, @StateObject, or @Observable in SwiftUI?▼

Use @State for simple local UI state, @StateObject for ViewModels owned by the view, and @EnvironmentObject or @Environment for global dependencies. On iOS 17+, prefer the @Observable macro for cleaner state management.

Can I mix UIKit and SwiftUI in the same app?▼

This Skill strictly bans UIKit unless bridging is unavoidable. Declarative SwiftUI trees are more predictable and token-efficient for AI-generated code, so UIKit should only appear in isolated bridging layers.

How should dates be stored and transmitted in iOS apps?▼

Store all Date values in UTC and serialize with ISO8601DateFormatter using internet date time and fractional seconds. Transmit as epoch milliseconds or ISO-8601 UTC strings, and inject a ClockProvider instead of calling Date() directly.

What does Swift 6 mode require for SwiftUI ViewModels?▼

Swift 6 mode enables complete concurrency checking, requiring all types crossing actor boundaries to conform to Sendable. ViewModels must remain @MainActor-isolated to guarantee UI updates occur on the main thread.