Authoring Apple Immersive Video
At a glance
| Item | Summary |
|---|---|
| Purpose | Prepare and package immersive video content for delivery. |
| App architecture | A Swift sample centered on CreateAIVU, with direct use of AVFoundation, ImmersiveMediaSupport, ArgumentParser. |
| Main patterns | No named application pattern supported by the extracted structure |
| Project style | 2 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries. |
| Execution model | Source-visible boundaries: async declaration or closure; none alone proves a background thread. |
| State/event model | No structured observation or publisher-scheduling marker indexed. |
| Key frameworks/packages | AVFoundation, Foundation, ImmersiveMediaSupport, ArgumentParser; these are source dependencies, not architecture labels. |
Project structure
Source bundle/
├── ImmersiveMediaSupport Authoring/
│ ├── CreateAIVU.swift
│ └── CreateAIVUWriter.swift
├── Configuration/
│ └── SampleCode.xcconfig
└── ImmersiveMediaSupport Authoring.xcodeproj/
├── .xcodesamplecode.plist
└── project.pbxproj
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 3 project/configuration file(s) and 3 source declaration(s).
Overall architecture
flowchart LR
N1["CreateAIVU"]
N2["ImmersiveMediaSupport APIs"]
N1 --> N2
Reference code
ImmersiveMediaSupport Authoring/CreateAIVU.swift:14 — architecture anchor
@main
struct CreateAIVU: AsyncParsableCommand {
// ...
var inputFile: String
// ...
}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 Immersive Media Support.
Ownership and state
classDiagram
CreateAIVU *-- String : inputFile
CreateAIVU *-- String : aimeFile
CreateAIVU *-- String : usdzFile
CreateAIVU *-- String : maskFile
Ownership evidence
ImmersiveMediaSupport Authoring/CreateAIVU.swift:17 — stored dependency or nearest verified ownership anchor
@main
struct CreateAIVU: AsyncParsableCommand {
// ...
var inputFile: String
// ...
}| Owner | Object or state | Relationship | Mutation authority |
|---|---|---|---|
CreateAIVU |
String (inputFile) |
owns value state | App/module collaborators |
CreateAIVU |
String (aimeFile) |
owns value state | App/module collaborators |
CreateAIVU |
String (usdzFile) |
owns value state | App/module collaborators |
CreateAIVU |
String (maskFile) |
owns value state | App/module collaborators |
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 |
|---|---|---|---|
| Suspension boundary | async declaration or closure |
The source declares or crosses an asynchronous boundary; it does not by itself establish background execution. | ImmersiveMediaSupport Authoring/CreateAIVU.swift:35 |
@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
ImmersiveMediaSupport Authoring/CreateAIVU.swift:35 — representative execution boundary
mutating func run() async throws {
guard outputFile.lowercased().hasSuffix(".aivu") else {
throw RuntimeError("Output file must end in .aivu")
}
// ...
}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 |
|---|---|---|---|
| Source import | AVFoundation |
The cited file imports this module; runtime use and architectural role are not inferred. | ImmersiveMediaSupport Authoring/CreateAIVU.swift:10 |
| Source import | Foundation |
The cited file imports this module; runtime use and architectural role are not inferred. | ImmersiveMediaSupport Authoring/CreateAIVU.swift:9 |
| Source import | ImmersiveMediaSupport |
The cited file imports this module; runtime use and architectural role are not inferred. | ImmersiveMediaSupport Authoring/CreateAIVU.swift:11 |
| Source import | ArgumentParser |
The cited file imports this module; runtime use and architectural role are not inferred. | ImmersiveMediaSupport Authoring/CreateAIVU.swift:12 |
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
ImmersiveMediaSupport Authoring/CreateAIVU.swift:15 — representative type boundary
@main
struct CreateAIVU: AsyncParsableCommand {
// ...
var inputFile: String
// ...
}| Type | Responsibility | Depends on or conforms to |
|---|---|---|
CreateAIVU |
Represents a feature value or composable behavior | AsyncParsableCommand |
RuntimeError |
Represents feature failure conditions | Error, CustomStringConvertible |
CreateAIVUWriter |
Owns feature behavior and collaborator lifecycle | Concrete collaborators/imported frameworks |
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 |
|---|---|---|---|
customCreatedCalibrationId (ImmersiveMediaSupport Authoring/CreateAIVU.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. |
createVenueDescriptor (ImmersiveMediaSupport Authoring/CreateAIVU.swift:70) |
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. |
createPresentationDescriptor (ImmersiveMediaSupport Authoring/CreateAIVU.swift:104) |
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. |
getMetadataItem (ImmersiveMediaSupport Authoring/CreateAIVUWriter.swift:102) |
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
ImmersiveMediaSupport Authoring/CreateAIVU.swift:33 — representative boundary
@main
struct CreateAIVU: AsyncParsableCommand {
// ...
private var customCreatedCalibrationId = "CustomCreatedCalibration"
// ...
}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 |
|---|---|---|
| Feature and framework orchestration | CreateAIVU |
The sample keeps the demonstrated path in its primary concrete type. |
Design patterns
| Pattern | Source evidence | Purpose or tradeoff |
|---|---|---|
| No named application pattern | ImmersiveMediaSupport Authoring/CreateAIVU.swift:14 |
The verified source directly composes concrete framework types; this document avoids forcing a pattern name. |
Main application flow
sequenceDiagram
participant CreateAIVU
participant CreateAIVUWriter
participant AIVUValidator
CreateAIVU->>CreateAIVU: createVenueDescriptor()
CreateAIVU->>CreateAIVU: createPresentationDescriptor()
CreateAIVU->>CreateAIVUWriter: create()
CreateAIVU->>AIVUValidator: validate()
Reference code
ImmersiveMediaSupport Authoring/CreateAIVU.swift:61 — run()
mutating func run() async throws {
guard outputFile.lowercased().hasSuffix(".aivu") else {
throw RuntimeError("Output file must end in .aivu")
}
print("Creating .aivu file")
// Setup the `inputURL` and `outputURL`.
let inputURL = URL(filePath: inputFile)
let outputURL = URL(filePath: outputFile)
// Create the `VenueDescriptor` for the AIVU file from the provided input options.
let venueDescriptor = try await createVenueDescriptor()
// Create a `PresentationDescriptor` for the AIVU file with some default commands.
let presentationDescriptor = try await createPresentationDescriptor(with: venueDescriptor)
print("Input: \(inputURL)")
print("Output: \(outputURL)")
if FileManager.default.fileExists(atPath: outputURL.path()) {
print("Output file already exists, removing to rewrite output file.")
try? FileManager.default.removeItem(at: outputURL)
}
// Use the writer to create the AIVU output file.
try await CreateAIVUWriter.create(from: inputURL, venue: venueDescriptor, presentation: presentationDescriptor, to: outputURL)
// Validate the created AIVU file.
let valid = try await AIVUValidator.validate(url: outputURL)
guard valid else {
throw RuntimeError("Invalid AIVU file created.")
}
}Naming conventions
- Types: feature-specific names rather than reusable layer suffixes.
- Protocols: no local protocol declaration in the scanned source.
- Methods:
run,createVenueDescriptor,createPresentationDescriptor,create,getMetadataItem,getTimedMetadataGroup,getOutputProvider,getMetadataFormatDescription. - Files:
ImmersiveMediaSupport Authoring/CreateAIVU.swift,ImmersiveMediaSupport Authoring/CreateAIVUWriter.swift.
Architecture takeaways
CreateAIVUis the main source-visible entry or composition anchor for this sample.- Framework work reaches AVFoundation, ImmersiveMediaSupport, ArgumentParser 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 |
|---|---|
ImmersiveMediaSupport Authoring/CreateAIVU.swift |
Cited implementation, CreateAIVU, async declaration or closure, AVFoundation, Foundation, ImmersiveMediaSupport, ArgumentParser, RuntimeError |
ImmersiveMediaSupport Authoring/CreateAIVUWriter.swift |
Cited implementation, CreateAIVUWriter |