AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Swift Architecture Pro

skill-laxrajpurohit-swift-skills-pro-swift-architecture-pro · by laxrajpurohit

Use when structuring an iOS app — feature modularization, MVVM with @Observable, dependency injection, navigation routing, and layering for testability.

No reviews yet
0 installs
11 views
0.0% view→install

Install

$ agentstack add skill-laxrajpurohit-swift-skills-pro-swift-architecture-pro

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-laxrajpurohit-swift-skills-pro-swift-architecture-pro)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Swift Architecture Pro? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Swift Architecture Pro

Structure apps so features are isolated, testable, and easy to reason about.

When to use

  • Setting up or refactoring app architecture.
  • Deciding module/folder boundaries, DI, or navigation.
  • Untangling massive views or view models.

Trigger: /swift-architecture-pro.

Core principles

  • Organize by feature, not by technical layer.
  • Views are dumb; logic lives in @Observable models.
  • Depend on protocols, inject implementations — no singletons reached from inside views.
  • Keep types small and single-purpose; a growing file signals split needed.

Folder layout — by feature

❌ By layer

Views/  Models/  ViewModels/  Services/   // every feature scattered across all four

✅ By feature

Features/
  Feed/      FeedView.swift  FeedModel.swift  FeedService.swift
  Profile/   ProfileView.swift ProfileModel.swift
Core/        Networking/  Persistence/  DesignSystem/

MVVM with @Observable

@MainActor @Observable
final class FeedModel {
    private(set) var posts: [Post] = []
    private let service: FeedServing
    init(service: FeedServing) { self.service = service }
    func load() async { posts = (try? await service.posts()) ?? [] }
}

struct FeedView: View {
    @State private var model: FeedModel
    var body: some View {
        List(model.posts) { PostRow($0) }
            .task { await model.load() }
    }
}

View has no networking, no business rules — only presentation.

Dependency injection

❌ Singleton reached from inside

final class FeedModel {
    func load() async { posts = await API.shared.posts() }   // untestable
}

✅ Protocol injected

protocol FeedServing { func posts() async throws -> [Post] }
final class FeedModel { init(service: FeedServing) { ... } }
// tests inject a fake; app injects the real one

Navigation routing

Centralize a typed route; drive NavigationStack from it.

enum Route: Hashable { case detail(Post.ID), settings }

@Observable final class Router { var path: [Route] = [] }

NavigationStack(path: $router.path) {
    HomeView()
        .navigationDestination(for: Route.self) { route in
            switch route { case .detail(let id): DetailView(id: id)
                           case .settings: SettingsView() }
        }
}

Don't scatter NavigationLink(destination:) literals across the tree.

Layering

View → Model (@Observable) → Service (protocol) → Client (network/db). Dependencies point downward only; lower layers never import UI.

Common mistakes checklist

  • [ ] Folders by layer instead of by feature.
  • [ ] Networking/business logic inside a View.
  • [ ] Singletons reached from inside models (inject protocols instead).
  • [ ] Navigation destinations scattered instead of a typed router.
  • [ ] God objects — one model/view doing many features.
  • [ ] Lower layers importing SwiftUI/UIKit.

Output format (when reviewing)

Per issue: file:line, the boundary violated, suggested split. Lead with testability blockers (hard-wired singletons, logic in views).

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.