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 AppDelegate → ConfigureMenuTableViewController → DataManager → IntentHandler → Intents 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. |
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
flowchart LR
N1["AppDelegate"]
N2["ConfigureMenuTableViewController"]
N3["DataManager"]
N4["IntentHandler"]
N5["Intents APIs"]
N1 --> N2
N2 --> N3
N3 --> N4
N4 --> N5
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
classDiagram
OrderDetailViewController o-- Purpose : purpose
OrderDetailViewController o-- UICollectionView : collectionView
OrderDetailViewController o-- UICollectionViewDiffableDataSource : dataSource
OrderDetailViewController o-- CellRegistration : titleCellRegistration
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
}
}
private var collectionView: UICollectionView! = 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.
Class and protocol design
Shared/Support/Localizable.swift:11 — representative type boundary
protocol LocalizableShortcutString {
// ...
}| 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: MenuItemTopping → LocalizableShortcutString, MenuItem → LocalizableShortcutString, MenuItem → LocalizableCurrency, Order → LocalizableCurrency.
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
AppDelegateis 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/OrderDetailViewController.swift |
OrderDetailViewController, Purpose, Section, CellType, Item |
Shared/Data/DataManager.swift |
UserDefaultsStorageDescriptor, DataManager |
SoupChef/UI/AppDelegate.swift |
AppDelegate |
SoupChef/UI/OrderHistoryViewController.swift |
OrderHistoryViewController, SegueIdentifiers, Section |
SoupChef/UI/SoupMenuViewController.swift |
SoupMenuViewController, SegueIdentifiers, Section |
SoupChef/UI/ConfigureMenuTableViewController.swift |
ConfigureMenuTableViewController, SectionType |
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 |