Canvatorium Visio Lab 5036
TabView in Volumes
Ornaments are now supported in Volumes in visionOS 2. TabView seems to work well, but I’m not sure when I would use this.
This lab uses TabView to show content from three RealityView
scenes.
struct Lab5036: View {
var body: some View {
TabView {
RealityView { content in
let model = ModelEntity(
mesh: .generateSphere(radius: 0.25),
materials: [SimpleMaterial(color: .red, isMetallic: false)])
content.add(model)
}
.tabItem {
Image(systemName: "1.square")
Text("One")
}
RealityView { content in
let model = ModelEntity(
mesh: .generateCylinder(height: 0.4, radius: 0.2),
materials: [SimpleMaterial(color: .blue, isMetallic: false)])
content.add(model)
}
.tabItem {
Image(systemName: "2.square")
Text("Two")
}
RealityView { content in
let model = ModelEntity(
mesh: .generateCone(height: 0.4, radius: 0.2),
materials: [SimpleMaterial(color: .green, isMetallic: false)])
content.add(model)
}
.tabItem {
Image(systemName: "3.square")
Text("Three")
}
}
}
}