Skip to content

Instantly share code, notes, and snippets.

@robinkanatzar
Created August 4, 2024 14:02
Show Gist options
  • Save robinkanatzar/127abf4ca28347d66e38041e9611f004 to your computer and use it in GitHub Desktop.
Save robinkanatzar/127abf4ca28347d66e38041e9611f004 to your computer and use it in GitHub Desktop.
Accessibility + visionOS: Observe reduced motion system setting
import SwiftUI
/// An example view that listens to the user's system settings
/// about preferring motion
struct ReducedMotionView: View {
@Environment(\.accessibilityReduceMotion)
private var accessibilityReduceMotion
var body: some View {
if accessibilityReduceMotion {
Text("User does NOT like motion... 🤮")
} else {
Text("User is ok with things that move.")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment