Canvatorium Visio Lab 5031
Using Preferred Surroundings Effect
SwiftUI in visionOS has a modifier called preferredSurroundingsEffect that takes a SurroundingsEffect. The only effect I can find is .systemDark
The effect is pretty subtle, but it works. It looks a little better in the headset.
struct Lab5031: View {
var body: some View {
RealityView { content in
let model = ModelEntity(
mesh: .generateBox(size: 0.3, cornerRadius: 8.0),
materials: [SimpleMaterial(color: .black, isMetallic: false)])
model.position = SIMD3(x: 0, y: 1.3, z: -1)
content.add(model)
}
.preferredSurroundingsEffect(.systemDark)
}
}