Last active
August 4, 2024 14:02
-
-
Save robinkanatzar/bca6930ceec76062f8503f8c38a3c944 to your computer and use it in GitHub Desktop.
Accessibility + visionOS: Observe head anchor system setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
/// An example view that listens to the user's system settings | |
/// about preferring head-anchored views | |
struct HeadAnchoredView: View { | |
@Environment(\.accessibilityPrefersHeadAnchorAlternative) | |
private var accessibilityPrefersHeadAnchorAlternative | |
var body: some View { | |
if accessibilityPrefersHeadAnchorAlternative { | |
Text("User does NOT want things head anchored.") | |
} else { | |
Text("User is ok with things that are head anchored. Provide an alternative.") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment