macOS App Architecture Planner
Design a clean, production-ready architecture for a native macOS app using SwiftUI, including data flow, persistence, and system integration.
Prompt Template
You are a senior Apple platform engineer specializing in macOS app development. Help me plan the architecture for a native macOS application. **App Concept:** [describe what the app does — e.g., "A bookmark collector that lets users save, tag, organize, and search web bookmarks with automatic metadata extraction"] **Target macOS Version:** [e.g., macOS 14 Sonoma+] **Key Features:** - [Feature 1] - [Feature 2] - [Feature 3] **Data Requirements:** [what data the app stores/manages] **System Integrations:** [e.g., Menu Bar, Share Extension, Spotlight, iCloud Sync, Shortcuts] Please provide: 1. **Architecture Pattern** — recommend MVVM, TCA, or another pattern with justification 2. **Project Structure** — folder/group layout with file responsibilities 3. **Data Layer** — persistence strategy (SwiftData, Core Data, SQLite, or file-based) with model definitions 4. **View Hierarchy** — main window structure, NavigationSplitView layout, toolbar design 5. **Key SwiftUI Views** — skeleton code for the 3-4 most important views 6. **macOS-Specific Features** — how to leverage the platform (keyboard shortcuts, drag & drop, menu bar, Services, Spotlight indexing) 7. **Networking** (if applicable) — how to fetch/sync data 8. **Error Handling** — strategy for user-facing errors 9. **Testing Strategy** — what to unit test vs. UI test 10. **Distribution** — App Store vs. direct distribution considerations
Example Output
Architecture: Bookmark Collector for macOS
Pattern: MVVM + Repository
SwiftUI pairs naturally with MVVM. A Repository layer abstracts SwiftData, keeping ViewModels testable.
Project Structure
BookmarkCollector/
├── App/
│ ├── BookmarkCollectorApp.swift # @main, WindowGroup, MenuBarExtra
│ └── AppState.swift # Shared app-level state
├── Models/
│ ├── Bookmark.swift # @Model — url, title, tags, thumbnail, dateAdded
│ ├── Tag.swift # @Model — name, color
│ └── Collection.swift # @Model — name, bookmarks relationship
├── ViewModels/
│ ├── BookmarkListViewModel.swift # Fetch, filter, search, bulk actions
│ ├── BookmarkDetailViewModel.swift # Edit, metadata refresh
│ └── ImportViewModel.swift # Browser import logic
├── Views/
│ ├── Sidebar/
│ │ ├── SidebarView.swift # Collections, smart folders, tags
│ │ └── TagCloudView.swift
│ ├── Content/
│ │ ├── BookmarkGridView.swift # Thumbnail grid / list toggle
│ │ └── BookmarkRowView.swift
│ ├── Detail/
│ │ └── BookmarkDetailView.swift # Full metadata, preview, edit
│ └── Shared/
│ ├── SearchBar.swift
│ └── TagPicker.swift
├── Services/
│ ├── MetadataService.swift # Open Graph / favicon fetcher
│ ├── SpotlightIndexer.swift # CSSearchableIndex integration
│ └── BookmarkImporter.swift # Safari/Chrome bookmark parser
├── Extensions/
│ ├── ShareExtension/ # Share sheet target
│ └── SpotlightExtension/
└── Resources/
└── Assets.xcassets
Data Layer (SwiftData)
@Model
class Bookmark {
var url: URL
var title: String
var summary: String?
var tags: [Tag]
var collection: Collection?
var thumbnail: Data?
var dateAdded: Date
var lastVisited: Date?
var isFavorite: Bool
}
Main Window (NavigationSplitView)
NavigationSplitView {
SidebarView() // Collections + Tags
} content: {
BookmarkGridView() // Grid/List of bookmarks
} detail: {
BookmarkDetailView() // Selected bookmark preview + metadata
}
.toolbar { ... } // Add, Import, Search, View Toggle
macOS Features
- **⌘K** Quick search (floating panel, like Spotlight)
- **Drag & Drop** URLs from browsers directly into the grid
- **Share Extension** Save from Safari/any app
- **Menu Bar** Quick-add widget
- **Spotlight** Index bookmarks for system-wide search
- **Keyboard shortcuts** ⌘N (new), ⌘T (tag), Delete, arrow navigation
Tips for Best Results
- 💡Specify if you need iCloud sync — it significantly affects architecture choices
- 💡Mention your minimum macOS version, as SwiftData requires macOS 14+
- 💡List specific macOS integrations you want (Menu Bar, Widgets, Shortcuts) upfront
- 💡If migrating from an iOS app, mention it — the architecture will differ for macOS idioms
Related Prompts
SwiftUI macOS View Builder
Generate production-quality SwiftUI views tailored for macOS, with proper AppKit idioms, keyboard navigation, and platform-native feel.
macOS Menu Bar App Generator
Build a complete macOS menu bar (status bar) app with SwiftUI, including popover UI, keyboard shortcuts, and launch-at-login support.
macOS Document-Based App Builder
Create a native macOS document-based app with SwiftUI, supporting custom file formats, autosave, versioning, and iCloud Documents.