Model3DPhase
The current phase of the asynchronous model loading operation.
Declaration
enum Model3DPhaseOverview
When you create a Model3D instance with the init(url:transaction:content:) or Model3D/init(named:transaction:content:) initializers, you define the appearance of the view using a content closure. Model3D calls the closure with a phase value at different points during the load operation to indicate the current state. Use the phase to decide what to display. For example, you can display the loaded model if it exists, a view that indicates an error, or a placeholder:
let url = URL(string: "https://example.com/robot.usdz")!
Model3D(url: url) { phase in
if let model = phase.model {
model // Displays the loaded model.
} else if phase.error != nil {
Color.red // Indicates an error.
} else {
ProgressView()
}
}