Providing custom models for captured rooms and structure exports
At a glance
| Item | Summary |
|---|---|
| Purpose | Enhance the look of an exported 3D model by substituting object bounding boxes with detailed 3D renditions. |
| App architecture | A Swift sample bundle with entry-bearing project variants RoomPlanCatalogGenerator, RoomPlanExporter, each leading to RoomPlan APIs. |
| Main patterns | No named application pattern supported by the extracted structure |
| Project style | 5 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries. |
Project structure
Source bundle/
├── RoomPlanCatalogGenerator/
│ ├── RoomPlanCatalogGenerator.swift
│ ├── RoomPlanCatalog.swift
│ └── URL+CatalogExtensions.swift
├── RoomPlanExporter/
│ ├── RoomPlanExporterApp.swift
│ ├── ContentView.swift
│ └── RoomPlanCatalog.bundle/
│ └── catalog.plist
├── Configuration/
│ └── SampleCode.xcconfig
└── RoomPlanCatalogGenerator.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 4 project/configuration file(s) and 14 source declaration(s).
Overall architecture
flowchart LR
Bundle["Sample bundle"]
V1["RoomPlanCatalogGenerator"]
V2["RoomPlanExporter"]
Boundary["RoomPlan APIs"]
Bundle --> V1
V1 --> Boundary
Bundle --> V2
V2 --> Boundary
Reference code
RoomPlanCatalogGenerator/RoomPlanCatalogGenerator.swift:14 — architecture anchor
@main
struct RoomPlanCatalogGenerator: ParsableCommand {
static let configuration = CommandConfiguration(commandName: "RoomPlanCatalogGenerator",
abstract: "RoomPlan Catalog Generator",
subcommands: [CreateFolderHierarchy.self,
GenerateCatalog.self,
ConvertRoom.self])
}Interpretation
The branches represent separate entry-bearing project variants in the downloaded bundle, not runtime calls between those variants. Each branch is intentionally collapsed at the documented framework boundary; the detailed target-local flow remains in the cited files. Ownership is claimed only where the next section cites a stored property or assignment.
Ownership and state
classDiagram
RoomPlanCatalogGenerator *-- CommandConfiguration : configuration
CreateFolderHierarchy *-- CommandConfiguration : configuration
Options *-- String : inputPath
Options o-- Options : options
Ownership evidence
RoomPlanCatalogGenerator/RoomPlanCatalogGenerator.swift:16 — stored dependency or nearest verified ownership anchor
static let configuration = CommandConfiguration(commandName: "RoomPlanCatalogGenerator",
abstract: "RoomPlan Catalog Generator",
subcommands: [CreateFolderHierarchy.self,
GenerateCatalog.self,
ConvertRoom.self])| Owner | Object or state | Relationship | Mutation authority |
|---|---|---|---|
RoomPlanCatalogGenerator |
CommandConfiguration (configuration) |
creates and retains | Initialized by the owner; the binding is immutable |
CreateFolderHierarchy |
CommandConfiguration (configuration) |
creates and retains | Initialized by the owner; the binding is immutable |
Options |
String (inputPath) |
owns value state | App/module collaborators |
Options |
Options (options) |
stores or receives | 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.
Class and protocol design
RoomPlanExporter/RoomPlanExporterApp.swift:12 — representative type boundary
struct RoomPlanExporterApp: App {
// ...
}| Type | Responsibility | Depends on or conforms to |
|---|---|---|
RoomPlanExporterApp |
Application entry and top-level composition | App |
RoomPlanCatalogGenerator |
Generates feature data or resources | ParsableCommand |
ContentView |
User-interface presentation and input forwarding | View |
GeneratorError |
Represents feature failure conditions | LocalizedError |
CreateFolderHierarchy |
Represents a feature value or composable behavior | ParsableCommand |
Options |
Carries feature or framework configuration | ParsableArguments |
GenerateCatalog |
Represents a feature value or composable behavior | ParsableCommand |
Options |
Carries feature or framework configuration | ParsableArguments |
ConvertRoom |
Represents a feature value or composable behavior | ParsableCommand |
Options |
Carries feature or framework configuration | ParsableArguments |
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 |
|---|---|---|---|
modelFilename (RoomPlanCatalogGenerator/RoomPlanCatalog.swift:102) |
private(set) |
Read access follows the declaration; writes remain in the private scope. | Inference: allow observation while reserving invariant-changing writes for the owner. |
defaultCategoryAttributeFolderName (RoomPlanCatalogGenerator/RoomPlanCatalog.swift:108) |
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. |
generateFolderRelativePath (RoomPlanCatalogGenerator/RoomPlanCatalog.swift:145) |
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. |
chechInputURL (RoomPlanCatalogGenerator/RoomPlanCatalogGenerator.swift:184) |
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
RoomPlanCatalogGenerator/RoomPlanCatalog.swift:102 — representative boundary
private(set) var modelFilename: String? = nil
/// The resources file path component.
static let resourcesFolderName = "Resources"
/// The default category file path component.
private static let defaultCategoryAttributeFolderName = "Default"
/// Creates a catalog attributes instance with the given object category and attributes array.
init(category: CapturedRoom.Object.Category, attributes: [any CapturedRoomAttribute]) {
// ...
}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 |
|---|---|---|
| Application entry and top-level composition | RoomPlanExporterApp |
The source’s App suffix makes this role explicit. |
| Generates feature data or resources | RoomPlanCatalogGenerator |
The source’s Generator suffix makes this role explicit. |
| User-interface presentation and input forwarding | ContentView |
The source’s View suffix makes this role explicit. |
Design patterns
| Pattern | Source evidence | Purpose or tradeoff |
|---|---|---|
| No named application pattern | RoomPlanCatalogGenerator/RoomPlanCatalogGenerator.swift:14 |
The verified source directly composes concrete framework types; this document avoids forcing a pattern name. |
Naming conventions
- Types: App: RoomPlanExporterApp; Generator: RoomPlanCatalogGenerator; View: ContentView.
- Protocols: no local protocol declaration in the scanned source.
- Methods:
run,chechInputURL,writeCatalog,createModel,createUSDC,cleanCatalogPackage,load,export. - Files:
RoomPlanCatalogGenerator/RoomPlanCatalogGenerator.swift,RoomPlanExporter/RoomPlanExporterApp.swift,RoomPlanExporter/ContentView.swift,RoomPlanCatalogGenerator/RoomPlanCatalog.swift.
Architecture takeaways
RoomPlanCatalogGeneratoris the main source-visible entry or composition anchor for this sample.- Framework work reaches RoomPlan, SwiftUI, ArgumentParser, ModelIO 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 |
|---|---|
RoomPlanCatalogGenerator/RoomPlanCatalogGenerator.swift |
RoomPlanCatalogGenerator, GeneratorError, CreateFolderHierarchy, Options, GenerateCatalog, Options, ConvertRoom, Options |
RoomPlanExporter/RoomPlanExporterApp.swift |
RoomPlanExporterApp |
RoomPlanExporter/ContentView.swift |
CatalogError, ContentView, ExportState, ContentView_Previews |
RoomPlanCatalogGenerator/RoomPlanCatalog.swift |
RoomPlanCatalog, RoomPlanCatalogCategoryAttribute, CodingKeys |
RoomPlanCatalogGenerator/URL+CatalogExtensions.swift |
Feature implementation |