Sample CodeiOS, iPadOS, Mac Catalyst, watchOSReviewed 2026-07-21View on Apple Developer

Soup Chef: Accelerating App Interactions with Shortcuts

At a glance

Item Summary
Purpose Make it easy for people to use Siri with your app by providing shortcuts to your app’s actions.
App architecture A C/Objective-C header, Swift sample with the source-visible chain AppDelegateConfigureMenuTableViewControllerDataManagerIntentHandlerIntents APIs.
Main patterns View-controller organization, Protocol-oriented abstraction, Delegate or data-source callbacks
Project style 31 scanned source file(s) across C/Objective-C header, Swift, organized around ranked entry, type, and file boundaries.
Execution model Source-visible boundaries: DispatchQueue(label:); none alone proves a background thread.
State/event model Source-visible mechanisms: NotificationCenter.
Key frameworks/packages SoupKit, Foundation, UIKit, os, Intents; these are source dependencies, not architecture labels.

Project structure

Source bundle/
├── SoupChef/
│   └── UI/
│       ├── OrderDetailViewController.swift
│       ├── AppDelegate.swift
│       ├── OrderHistoryViewController.swift
│       ├── SoupMenuViewController.swift
│       └── ConfigureMenuTableViewController.swift
├── Shared/
│   └── Data/
│       ├── DataManager.swift
│       ├── SoupMenuManager.swift
│       └── SoupOrderDataManager.swift
├── SoupChefIntentsUI/
│   ├── InvoiceViewController.swift
│   └── OrderConfirmedViewController.swift
└── Supporting Targets/
    └── SoupChefWatch Extension/
        ├── HistoryInterfaceController.swift
        └── MenuInterfaceController.swift

Structure observations

  • Architecturally prominent files are ranked from entry points and role-named declarations; resource-only paths are omitted.
  • Primary languages: C/Objective-C header, Swift.
  • The verified tree contains 21 project/configuration file(s) and 47 source declaration(s).

Overall architecture

Reference code

SoupChef/UI/AppDelegate.swift:12 — architecture anchor

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

}

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 Intents.

Ownership and state

Ownership evidence

SoupChef/UI/OrderDetailViewController.swift:26 — stored dependency or nearest verified ownership anchor

    var purpose: Purpose = .newOrder {
        didSet {
            navigationItem.rightBarButtonItem = (purpose == .newOrder) ? orderButton : nil
        }
    }
Owner Object or state Relationship Mutation authority
OrderDetailViewController Purpose (purpose) stores or receives App/module collaborators
OrderDetailViewController UICollectionView (collectionView) stores or receives Owning lexical scope
OrderDetailViewController UICollectionViewDiffableDataSource (dataSource) stores or receives Owning lexical scope
OrderDetailViewController CellRegistration (titleCellRegistration) stores or receives Owning lexical scope

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.

Concern Source mechanism Verified placement or handoff Evidence
Queue scheduling DispatchQueue(label:) The source constructs a dispatch queue; its label alone does not prove a thread. Shared/Data/DataManager.swift:30

@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.

Reference code

Shared/Data/DataManager.swift:30 — representative execution boundary

public class DataManager<ManagedDataType: Codable> {
    // ...
    private let userDefaultsAccessQueue = DispatchQueue(label: "User Defaults Access Queue")
    // ...
}

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. Shared/Data/DataManager.swift:77
Source import SoupKit The cited file imports this module; runtime use and architectural role are not inferred. SoupChef/UI/AddToSiriCollectionViewCell.swift:10
Source import Foundation The cited file imports this module; runtime use and architectural role are not inferred. Shared/Data/DataManager.swift:8
Source import UIKit The cited file imports this module; runtime use and architectural role are not inferred. Shared/OrderSoupIntentHandler.swift:8
Source import os The cited file imports this module; runtime use and architectural role are not inferred. Shared/Data/DataManager.swift:9
Source import Intents The cited file imports this module; runtime use and architectural role are not inferred. Shared/Data/Order.swift:11
Source import WatchKit The cited file imports this module; runtime use and architectural role are not inferred. Supporting Targets/SoupChefWatch Extension/ExtensionDelegate.swift:8

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

Shared/Support/Localizable.swift:11 — representative type boundary

protocol LocalizableShortcutString {
    // ...
    func localizedName(useDeferredIntentLocalization: Bool) -> String
}
Type Responsibility Depends on or conforms to
AppDelegate Receives callback-driven events UIResponder, UIApplicationDelegate
OrderDetailViewController View lifecycle, callbacks, and feature coordination UIViewController
DataManager Long-lived feature or framework coordination Concrete collaborators/imported frameworks
OrderHistoryViewController View lifecycle, callbacks, and feature coordination UIViewController
SoupMenuViewController View lifecycle, callbacks, and feature coordination UIViewController
ConfigureMenuTableViewController View lifecycle, callbacks, and feature coordination UITableViewController
InvoiceViewController View lifecycle, callbacks, and feature coordination UIViewController
InvoiceView User-interface presentation and input forwarding UIView
OrderConfirmedViewController View lifecycle, callbacks, and feature coordination UIViewController
OrderConfirmedView User-interface presentation and input forwarding UIView

The source explicitly defines local protocol relationships: MenuItemToppingLocalizableShortcutString, MenuItemLocalizableShortcutString, MenuItemLocalizableCurrency, OrderLocalizableCurrency.

Access control

Symbol Access Verified effect Likely rationale
dataChangedNotificationKey (Shared/Data/DataManager.swift:21) public The symbol is visible to importing modules. Inference: make the declaration available across a module or target boundary.
userDefaultsAccessQueue (Shared/Data/DataManager.swift:30) 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.
storageDescriptor (Shared/Data/DataManager.swift:33) 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.
ignoreLocalUserDefaultsChanges (Shared/Data/DataManager.swift:36) 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.

Reference code

Shared/Data/DataManager.swift:21 — representative boundary

public let dataChangedNotificationKey = NSNotification.Name(rawValue: "DataChangedNotification")

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 ConfigureMenuTableViewController, HistoryInterfaceController, HistoryItemRowController, IntentViewController The source’s Controller suffix makes this role explicit.
Receives callback-driven events AppDelegate, ExtensionDelegate, SceneDelegate The source’s Delegate suffix makes this role explicit.
Handles callbacks or feature events IntentHandler, OrderSoupIntentHandler The source’s Handler suffix makes this role explicit.
Long-lived feature or framework coordination DataManager, SoupMenuManager, SoupOrderDataManager The source’s Manager suffix makes this role explicit.
User-interface presentation and input forwarding AddToSiriCollectionViewCellContentView, InvoiceView, OrderConfirmedView The source’s View suffix makes this role explicit.

Design patterns

Pattern Source evidence Purpose or tradeoff
View-controller organization SoupChef/UI/ConfigureMenuTableViewController.swift:13 A controller is the verified coordination boundary; this is MVC-style only where a separate model is present.
Protocol-oriented abstraction Shared/Data/Order.swift:15 A local protocol and concrete conformance create an explicit capability boundary.
Delegate or data-source callbacks SoupChef/UI/AppDelegate.swift:13 Callback protocols invert event delivery back into the sample’s owner.

Naming conventions

  • Types: Controller: ConfigureMenuTableViewController, HistoryInterfaceController, HistoryItemRowController, IntentViewController, InvoiceViewController; Delegate: AppDelegate, ExtensionDelegate, SceneDelegate; Handler: IntentHandler, OrderSoupIntentHandler; Manager: DataManager, SoupMenuManager, SoupOrderDataManager; View: AddToSiriCollectionViewCellContentView, InvoiceView, OrderConfirmedView.
  • Protocols: LocalizableShortcutString, LocalizableCurrency.
  • Methods: awakeFromNib, present, addVoiceShortcutViewController, addVoiceShortcutViewControllerDidCancel, editVoiceShortcutViewController, editVoiceShortcutViewControllerDidCancel, configureCollectionView, createCollectionViewLayout.
  • Files: SoupChef/UI/OrderDetailViewController.swift, Shared/Data/DataManager.swift, SoupChef/UI/AppDelegate.swift, SoupChef/UI/OrderHistoryViewController.swift, SoupChef/UI/SoupMenuViewController.swift, SoupChef/UI/ConfigureMenuTableViewController.swift.

Architecture takeaways

  • AppDelegate is the main source-visible entry or composition anchor for this sample.
  • Framework work reaches SoupKit, UIKit, Intents, WatchKit 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
SoupChef/UI/AppDelegate.swift Cited implementation, AppDelegate
SoupChef/UI/OrderDetailViewController.swift Cited implementation, OrderDetailViewController, Purpose, Section, CellType, Item
Shared/Support/Localizable.swift LocalizableShortcutString, LocalizableCurrency
Shared/Data/DataManager.swift Cited implementation, DispatchQueue(label:), NotificationCenter, Foundation, os, UserDefaultsStorageDescriptor, DataManager
SoupChef/UI/ConfigureMenuTableViewController.swift ConfigureMenuTableViewController, SectionType
Shared/Data/Order.swift Cited implementation, Intents, Order, MenuItemTopping, Location
SoupChef/UI/AddToSiriCollectionViewCell.swift SoupKit, AddToSiriCollectionViewCell, AddToSiriCellContentConfiguration, AddToSiriCollectionViewCellContentView
Shared/OrderSoupIntentHandler.swift UIKit, OrderSoupIntentHandler
Supporting Targets/SoupChefWatch Extension/ExtensionDelegate.swift WatchKit, ExtensionDelegate
SoupChef/UI/OrderHistoryViewController.swift OrderHistoryViewController, SegueIdentifiers, Section
SoupChef/UI/SoupMenuViewController.swift SoupMenuViewController, SegueIdentifiers, Section
SoupChefIntentsUI/InvoiceViewController.swift InvoiceViewController, InvoiceView
SoupChefIntentsUI/OrderConfirmedViewController.swift OrderConfirmedViewController, OrderConfirmedView
Supporting Targets/SoupChefWatch Extension/HistoryInterfaceController.swift HistoryInterfaceController, HistoryItemRowController
Supporting Targets/SoupChefWatch Extension/MenuInterfaceController.swift MenuInterfaceController, MenuItemRowController
Shared/Data/SoupMenuManager.swift SoupMenuManager