SurfaceSnappingInfo
A type representing information about the window scenes snap state.
Declaration
struct SurfaceSnappingInfoOverview
Use the provided SurfaceSnappingInfo to modify the contents of your view.
struct LightFixtureView: View {
@Environment(\.surfaceSnappingInfo)
var snappingInfo: SurfaceSnappingInfo
var body: some View {
if snappingInfo.isSnapped {
switch SurfaceSnappingInfo.authorizationStatus {
case .authorized:
switch snappingInfo.classification {
case .table:
LampView()
case .floor:
FloorLampView()
default:
DefaultLampView()
}
default:
DefaultLampView()
}
} else {
FloatingOrbLampView()
}
}
}The bottom of volumes may snap to horizontal surfaces and the back of windows may snap to vertical surfaces.