Building and improving your app with Mac Catalyst
At a glance
| Item | Summary |
|---|---|
| Purpose | Improve your iPadOS app with Mac Catalyst by supporting native controls, multiple windows, sharing, printing, menus and keyboard shortcuts. |
| App architecture | A Swift sample with the source-visible chain AppDelegate → BrowserSplitViewController → DetailToolbarModel → ItemPrintPageRenderer → UIKit APIs. |
| Main patterns | View-controller organization, Protocol-oriented abstraction, Delegate or data-source callbacks |
| Project style | 20 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries. |
| Execution model | No structured execution marker indexed; callback threading requires source review. |
| State/event model | Source-visible mechanisms: NotificationCenter. |
| Key frameworks/packages | UIKit, Foundation, CoreLocation, CoreGraphics, LinkPresentation; these are source dependencies, not architecture labels. |
Project structure
Source bundle/
└── Trip Planner/
├── AppDelegate.swift
├── Model/
│ └── DataModel.swift
├── SidebarViewController.swift
├── Printing/
│ └── ItemPrintPageRenderer.swift
├── SupplementaryViewController.swift
├── Item Detail/
│ ├── DetailSceneDelegate.swift
│ ├── RewardsProgramDetailViewController.swift
│ ├── DetailViewController.swift
│ ├── LocatedItemDetailViewController.swift
│ └── SharingImageView.swift
├── SceneDelegate.swift
└── BrowserSplitViewController.swift
Structure observations
- Architecturally prominent files are ranked from entry points and role-named declarations; resource-only paths are omitted.
- Primary languages: Swift.
- The verified tree contains 9 project/configuration file(s) and 38 source declaration(s).
Overall architecture
flowchart LR
N1["AppDelegate"]
N2["BrowserSplitViewController"]
N3["DetailToolbarModel"]
N4["ItemPrintPageRenderer"]
N5["UIKit APIs"]
N1 --> N2
N2 --> N3
N3 --> N4
N4 --> N5
Reference code
Trip Planner/AppDelegate.swift:10 — architecture anchor
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions) -> UISceneConfiguration {
if let activity = options.userActivities.first, activity.activityType == DetailSceneDelegate.activityType {
let config = UISceneConfiguration(name: "DetailViewer", sessionRole: connectingSceneSession.role)
return config
}
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
}Interpretation
The arrows summarize the source-visible entry, role-named types or folders, and framework direction; when nodes come from structural folders, the sequence is a high-level interpretation rather than proof that every adjacent node calls the next. Ownership is claimed only where the next section cites a stored property or assignment. The diagram is intentionally limited to the dominant path into UIKit.
Ownership and state
classDiagram
Country o-- ItemID : itemID
Country *-- String : name
Country *-- Array : lodgings
Country *-- Array : restaurants
Ownership evidence
Trip Planner/Model/DataModel.swift:39 — stored dependency or nearest verified ownership anchor
struct Country: ModelItem, IconNameProviding {
let itemID: ItemID
// ...
}| Owner | Object or state | Relationship | Mutation authority |
|---|---|---|---|
Country |
ItemID (itemID) |
stores or receives | Initialized by the owner; the binding is immutable |
Country |
String (name) |
owns value state | Initialized by the owner; the binding is immutable |
Country |
Array (lodgings) |
owns value state | Initialized by the owner; the binding is immutable |
Country |
Array (restaurants) |
owns value state | Initialized by the owner; the binding is immutable |
Composition arrows indicate a source-visible construction expression or locally owned value state; aggregation means the owner stores or receives a dependency without proving exclusive lifetime ownership.
Concurrency, scheduling, and thread safety
Evidence limit: actor isolation, async/await, or Task creation does not by itself prove background-thread execution; Sendable conformance alone does not prove thread-safe mutation.
No source-visible execution, scheduling, or synchronization boundary was found in the indexed source.
@MainActor/MainActor.run, DispatchQueue.main, and RunLoop.main are reported as distinct isolation, queue, and event-loop mechanisms. A plain Task is kept separate from Task.detached; neither is labeled as a background thread.
State propagation, frameworks, and dependencies
Evidence limit: an import proves a source-level compilation dependency at the cited line; it does not prove runtime use, architectural adoption, or whether a Swift package is a direct application dependency.
| Category | Mechanism or module | Verified role | Evidence |
|---|---|---|---|
| State propagation | NotificationCenter |
NotificationCenter distributes named process-local events. | Trip Planner/BrowserSplitViewController.swift:34 |
| Source import | UIKit |
The cited file imports this module; runtime use and architectural role are not inferred. | Trip Planner/AppDelegate.swift:8 |
| Source import | Foundation |
The cited file imports this module; runtime use and architectural role are not inferred. | Trip Planner/Model/DataModel.swift:8 |
| Source import | CoreLocation |
The cited file imports this module; runtime use and architectural role are not inferred. | Trip Planner/Model/DataModel.swift:9 |
| Source import | CoreGraphics |
The cited file imports this module; runtime use and architectural role are not inferred. | Trip Planner/Printing/ItemPrintPageRenderer.swift:9 |
| Source import | LinkPresentation |
The cited file imports this module; runtime use and architectural role are not inferred. | Trip Planner/Utility Extensions/ModelItem+UIConvenience.swift:10 |
| Source import | MapKit |
The cited file imports this module; runtime use and architectural role are not inferred. | Trip Planner/Item Detail/LocatedItemDetailViewController.swift:9 |
receive(on:) describes downstream delivery scheduling, while subscribe(on:) describes upstream subscription/request/cancel scheduling. An import Combine alone establishes neither behavior nor a Store, reducer, Redux, or other application architecture.
Class and protocol design
Trip Planner/Model/DataModel.swift:12 — representative type boundary
protocol Model {
var countries: [Country] { get }
var rewardsPrograms: [RewardsProgram] { get }
}| Type | Responsibility | Depends on or conforms to |
|---|---|---|
AppDelegate |
Receives callback-driven events | UIResponder, UIApplicationDelegate |
Model |
Defines a capability or collaboration contract | Concrete collaborators/imported frameworks |
SidebarViewController |
View lifecycle, callbacks, and feature coordination | UIViewController |
ItemPrintPageRenderer |
Owns drawing, GPU, or presentation processing | UIPrintPageRenderer |
SupplementaryViewController |
View lifecycle, callbacks, and feature coordination | UIViewController, UICollectionViewDragDelegate |
DetailSceneDelegate |
Receives callback-driven events | UIResponder, UIWindowSceneDelegate |
DetailToolbarModel |
Feature data or observable state | NSObject, NSToolbarDelegate |
RewardsProgramDetailViewController |
View lifecycle, callbacks, and feature coordination | UIViewController |
SceneDelegate |
Receives callback-driven events | UIResponder, UIWindowSceneDelegate |
MainSceneToolbarModel |
Feature data or observable state | NSObject, NSToolbarDelegate |
The source explicitly defines local protocol relationships: Country → ModelItem, Country → IconNameProviding, Lodging → IconNameProviding, Restaurant → IconNameProviding, Sight → IconNameProviding, RewardsProgram → ModelItem.
Access control
| Symbol | Access | Verified effect | Likely rationale |
|---|---|---|---|
selectedItemsCollection (Trip Planner/BrowserSplitViewController.swift:11) |
private(set) |
Read access follows the declaration; writes remain in the private scope. | Inference: allow observation while reserving invariant-changing writes for the owner. |
supplementarySelectionChangeObserver (Trip Planner/BrowserSplitViewController.swift:12) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
postBrowserStateChangeNotification (Trip Planner/BrowserSplitViewController.swift:53) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: hide an implementation step that is not part of the collaboration surface. |
updateDueToSelectedItemsChange (Trip Planner/BrowserSplitViewController.swift:57) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: hide an implementation step that is not part of the collaboration surface. |
Reference code
Trip Planner/BrowserSplitViewController.swift:11 — representative boundary
class BrowserSplitViewController: UISplitViewController {
private(set) var selectedItemsCollection = ModelItemsCollection()
// ...
}Swift declarations without a modifier are internal; explicit private, fileprivate, private(set), public, or open entries above are interpreted by language semantics. Objective-C/C samples instead rely on header and implementation boundaries, which are not equivalent to Swift lexical privacy.
Logic ownership and placement
| Logic | Owning type or file | Placement rationale |
|---|---|---|
| View lifecycle, callbacks, and feature coordination | BrowserSplitViewController, DetailViewController, LocatedItemDetailViewController, RewardsProgramDetailViewController |
The source’s Controller suffix makes this role explicit. |
| Receives callback-driven events | AppDelegate, DetailSceneDelegate, SceneDelegate |
The source’s Delegate suffix makes this role explicit. |
| Feature data or observable state | DetailToolbarModel, MainSceneToolbarModel, Model |
The source’s Model suffix makes this role explicit. |
| Owns drawing, GPU, or presentation processing | ItemPrintPageRenderer |
The source’s Renderer suffix makes this role explicit. |
| User-interface presentation and input forwarding | SharingImageView |
The source’s View suffix makes this role explicit. |
Design patterns
| Pattern | Source evidence | Purpose or tradeoff |
|---|---|---|
| View-controller organization | Trip Planner/BrowserSplitViewController.swift:10 |
A controller is the verified coordination boundary; this is MVC-style only where a separate model is present. |
| Protocol-oriented abstraction | Trip Planner/Model/DataModel.swift:38 |
A local protocol and concrete conformance create an explicit capability boundary. |
| Delegate or data-source callbacks | Trip Planner/AppDelegate.swift:11 |
Callback protocols invert event delivery back into the sample’s owner. |
Naming conventions
- Types: Controller: BrowserSplitViewController, DetailViewController, LocatedItemDetailViewController, RewardsProgramDetailViewController, SidebarViewController; Delegate: AppDelegate, DetailSceneDelegate, SceneDelegate; Model: DetailToolbarModel, MainSceneToolbarModel, Model; Renderer: ItemPrintPageRenderer; View: SharingImageView.
- Protocols:
Model,ItemIdentifierProviding,ImageProviding,LocationProviding,IconNameProviding,ModelItem,ImageNaming. - Methods:
application,isEqual,item,findItem,children,hash,loadView,addCountriesToSnapshot. - Files:
Trip Planner/AppDelegate.swift,Trip Planner/SidebarViewController.swift,Trip Planner/Printing/ItemPrintPageRenderer.swift,Trip Planner/SupplementaryViewController.swift,Trip Planner/Item Detail/DetailSceneDelegate.swift,Trip Planner/Item Detail/RewardsProgramDetailViewController.swift.
Architecture takeaways
AppDelegateis the main source-visible entry or composition anchor for this sample.- Framework work reaches UIKit, CoreLocation, CoreGraphics, LinkPresentation through a deliberately small high-level chain; the detailed API graph remains inside the cited implementation files.
- Stored-property evidence identifies lifecycle collaboration; it does not by itself prove exclusive object ownership.
- Access-control conclusions separate verified language visibility from the likely design rationale.
- Local protocol relationships provide an explicit substitution boundary.
Source map
| Source file | Relevant symbols |
|---|---|
Trip Planner/AppDelegate.swift |
Cited implementation, UIKit, AppDelegate |
Trip Planner/Model/DataModel.swift |
Cited implementation, Model, Foundation, CoreLocation, ItemIdentifierProviding, ImageProviding, LocationProviding, IconNameProviding, Country, Lodging, Restaurant, PriceRange, Sight, RewardsProgram, ModelItem, AnyModelItem |
Trip Planner/BrowserSplitViewController.swift |
Cited implementation, BrowserSplitViewController, NotificationCenter |
Trip Planner/Printing/ItemPrintPageRenderer.swift |
CoreGraphics, ItemPrintPageRenderer, func |
Trip Planner/Utility Extensions/ModelItem+UIConvenience.swift |
LinkPresentation, ToggleFavoriteActivity |
Trip Planner/Item Detail/LocatedItemDetailViewController.swift |
MapKit, LocatedItemDetailViewController |
Trip Planner/SidebarViewController.swift |
SidebarSection, SidebarItemIdentifier, Kind, SidebarViewController, DynamicImageCollectionViewCell |
Trip Planner/SupplementaryViewController.swift |
Section, ImageNaming, SupplementaryViewController |
Trip Planner/Item Detail/DetailSceneDelegate.swift |
DetailSceneDelegate, DetailToolbarModel |
Trip Planner/Item Detail/RewardsProgramDetailViewController.swift |
EmojiKnobSlider, RewardsProgramDetailViewController |
Trip Planner/SceneDelegate.swift |
SceneDelegate, MainSceneToolbarModel |
Trip Planner/Item Detail/DetailViewController.swift |
DetailViewController |
Trip Planner/Item Detail/SharingImageView.swift |
SharingImageView |
Trip Planner/Item Detail/ImageCollectionViewConfigurationCell.swift |
ImageCollectionViewConfigurationCell |
Trip Planner/Model/ModelItemsCollection.swift |
ModelItemsCollection |
Trip Planner/Model/Sample Data/SampleData.swift |
SampleData |