- Added
readEnvironment
variants for reading specific key paths from the environment
readEnvironment(\.naturalUpDirection) { naturalUp in
Cylinder(diameter: 1, height: 10)
.rotated(to: naturalUp ?? .up)
}
- Added an
@EnvironmentValue
property wrapper that can be used in Shape2D
/Shape3D
for accessing values from the environment.
struct HollowBall: Shape3D {
let diameter: Double
let mountDiameter: Double
@EnvironmentValue(\.tolerance) var tolerance
var body: any Geometry3D {
Sphere(diameter: diameter)
.subtracting {
Cylinder(diameter: mountDiameter + tolerance, height: diameter)
}
}
}