Sample CodemacOSReviewed 2026-07-21View on Apple Developer

Build an Educational Assessment App

At a glance

Item Summary
Purpose Ensure the academic integrity of your assessment app by using Automatic Assessment Configuration.
App architecture A C/Objective-C header, Objective-C, Swift sample with the source-visible chain AppDelegateLogViewControllerAutomaticAssessmentConfiguration APIs.
Main patterns Delegate or data-source callbacks
Project style 11 scanned source file(s) across C/Objective-C header, Objective-C, Swift, organized around ranked entry, type, and file boundaries.
Execution model Source-visible boundaries: DispatchQueue.main.async; none alone proves a background thread.
State/event model Source-visible mechanisms: NotificationCenter.
Key frameworks/packages Cocoa, AutomaticAssessmentConfiguration, WebKit; these are source dependencies, not architecture labels.

Project structure

Source bundle/
├── Assessment Time/
│   ├── Swift/
│   │   ├── AppDelegate.swift
│   │   ├── WindowController.swift
│   │   ├── LogViewController.swift
│   │   └── ViewController.swift
│   └── Objective-C/
│       ├── main.m
│       ├── WindowController.m
│       ├── LogViewController.m
│       ├── ViewController.m
│       ├── LogViewController.h
│       ├── ViewController.h
│       └── WindowController.h
└── Assessment Time - SwiftUI.entitlements

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, Objective-C, Swift.
  • The verified tree contains 6 project/configuration file(s) and 7 source declaration(s).

Overall architecture

Reference code

Assessment Time/Swift/AppDelegate.swift:11 — architecture anchor

@main
@objc(AppDelegate)
class AppDelegate: NSObject, NSApplicationDelegate {

}

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 Automatic Assessment Configuration.

Ownership and state

Ownership evidence

Assessment Time/Objective-C/WindowController.m:11 — stored dependency or nearest verified ownership anchor

@interface WindowController () <AEAssessmentSessionDelegate>
@property (weak) IBOutlet NSToolbarItem *lockUnlockItem;
// ...
@end
Owner Object or state Relationship Mutation authority
WindowController NSToolbarItem (lockUnlockItem) holds a non-owning reference The referenced object’s lifecycle is owned elsewhere
WindowController NSSegmentedControl (calculatorOptions) holds a non-owning reference The referenced object’s lifecycle is owned elsewhere
WindowController NSSegmentedControl (dictionaryOptions) holds a non-owning reference The referenced object’s lifecycle is owned elsewhere
WindowController AEAssessmentSession (session) stores or receives Owning Objective-C implementation

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.main.async The source addresses the main dispatch queue. Assessment Time/Swift/LogViewController.swift:44

@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

Assessment Time/Swift/LogViewController.swift:44 — representative execution boundary

        DispatchQueue.main.async {
            self.logTextView.textStorage?.append( NSAttributedString(string: messageWithDate))
            self.logTextView.scrollToEndOfDocument(nil)
        }

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. Assessment Time/Swift/LogViewController.swift:25
Source import Cocoa The cited file imports this module; runtime use and architectural role are not inferred. Assessment Time/Objective-C/LogViewController.h:8
Source import AutomaticAssessmentConfiguration The cited file imports this module; runtime use and architectural role are not inferred. Assessment Time/Objective-C/WindowController.m:8
Source import WebKit The cited file imports this module; runtime use and architectural role are not inferred. Assessment Time/Objective-C/ViewController.m: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

Assessment Time/Swift/AppDelegate.swift:13 — representative type boundary

@main
@objc(AppDelegate)
class AppDelegate: NSObject, NSApplicationDelegate {

}
Type Responsibility Depends on or conforms to
AppDelegate Receives callback-driven events NSObject, NSApplicationDelegate
WindowController View lifecycle, callbacks, and feature coordination NSWindowController
LogViewController View lifecycle, callbacks, and feature coordination NSViewController
ViewController View lifecycle, callbacks, and feature coordination NSViewController
WindowController View lifecycle, callbacks, and feature coordination NSWindowController
LogViewController View lifecycle, callbacks, and feature coordination NSViewController
ViewController View lifecycle, callbacks, and feature coordination NSViewController

No local protocol conformance is claimed as protocol-oriented design; external framework conformances are listed only as dependencies.

Access control

Symbol Access Verified effect Likely rationale
logTextView (Assessment Time/Objective-C/LogViewController.m:11) implementation Visibility follows header/implementation and language linkage rules. Inference: keep the declaration in the Objective-C implementation boundary.
formatter (Assessment Time/Objective-C/LogViewController.m:12) implementation Visibility follows header/implementation and language linkage rules. Inference: keep the declaration in the Objective-C implementation boundary.
urlField (Assessment Time/Objective-C/ViewController.m:11) implementation Visibility follows header/implementation and language linkage rules. Inference: keep the declaration in the Objective-C implementation boundary.
webView (Assessment Time/Objective-C/ViewController.m:12) implementation Visibility follows header/implementation and language linkage rules. Inference: keep the declaration in the Objective-C implementation boundary.

Reference code

Assessment Time/Objective-C/LogViewController.m:11 — representative boundary

@interface LogViewController ()
@property (weak) IBOutlet NSTextView *logTextView;
@property (strong) NSDateFormatter *formatter;
@end

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 LogViewController, ViewController, WindowController The source’s Controller suffix makes this role explicit.
Receives callback-driven events AppDelegate The source’s Delegate suffix makes this role explicit.

Design patterns

Pattern Source evidence Purpose or tradeoff
Delegate or data-source callbacks Assessment Time/Swift/AppDelegate.swift:13 Callback protocols invert event delivery back into the sample’s owner.

Main application flow

Reference code

Assessment Time/Objective-C/WindowController.m:124attemptToOpenAppWithBundleID()

- (void) attemptToOpenAppWithBundleID:(NSString *) bundleID {
    NSURL *url = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:bundleID];
    [self log:@"Attempting to open bundle %@ from %@.", bundleID, url];
    if ( url != NULL ) {
        [[NSWorkspace sharedWorkspace] openApplicationAtURL:url
                                              configuration:[[NSWorkspaceOpenConfiguration alloc] init] completionHandler:^(NSRunningApplication * _Nullable app, NSError * _Nullable error) {
            if ( app != NULL ) {
                [self log:@"App successfully launched."];
            } else {
                [self log:@"App launch error: %@", [error localizedDescription]];
            }
        }];
    }
}

Naming conventions

  • Types: Controller: LogViewController, ViewController, WindowController; Delegate: AppDelegate.
  • Protocols: no local protocol declaration in the scanned source.
  • Methods: lockSession, windowDidLoad, setupAssessmentSession, participantConfiguration, attemptToOpenAppWithBundleID, updateConfiguration, updateLockButton, log.
  • Files: Assessment Time/Swift/AppDelegate.swift, Assessment Time/Objective-C/WindowController.m, Assessment Time/Swift/WindowController.swift, Assessment Time/Objective-C/LogViewController.m, Assessment Time/Objective-C/ViewController.m, Assessment Time/Objective-C/LogViewController.h.

Architecture takeaways

  • AppDelegate is the main source-visible entry or composition anchor for this sample.
  • Framework work reaches Cocoa, AutomaticAssessmentConfiguration, WebKit 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.
  • The source does not justify labeling the design protocol-oriented.

Source map

Source file Relevant symbols
Assessment Time/Swift/AppDelegate.swift Cited implementation, AppDelegate
Assessment Time/Objective-C/WindowController.m Cited implementation, AutomaticAssessmentConfiguration, WindowController
Assessment Time/Objective-C/LogViewController.m logTextView, formatter, LogViewController
Assessment Time/Objective-C/ViewController.m urlField, webView, WebKit, ViewController
Assessment Time/Swift/LogViewController.swift DispatchQueue.main.async, NotificationCenter, LogViewController
Assessment Time/Objective-C/LogViewController.h Cocoa, LogViewController
Assessment Time/Objective-C/main.m Feature implementation
Assessment Time/Swift/WindowController.swift WindowController
Assessment Time/Objective-C/ViewController.h ViewController
Assessment Time/Objective-C/WindowController.h WindowController
Assessment Time/Swift/ViewController.swift ViewController