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 RealityKit | |
// 1 - Create RealityKit Entity | |
let modelEntity = ModelEntity(/* ... */) | |
// 2 - Create AccessibilityComponent | |
var accessibilityComponent = AccessibilityComponent() | |
// 3 - Expose to assistive technology | |
accessibilityComponent.isAccessibilityElement = true |
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 motion | |
struct ReducedMotionView: View { | |
@Environment(\.accessibilityReduceMotion) | |
private var accessibilityReduceMotion | |
var body: some View { | |
if accessibilityReduceMotion { |
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 { |
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 accessible stack view that starts as an HStack | |
/// then becomes a VStack once the dynamic type size | |
/// is an accessibility size. | |
/// | |
/// Usage in a View: | |
/// ``` | |
/// var body: some View { | |
/// AStack(hStackAlignment: .top, hStackSpacing: 100, vStackAlignment: .leading, vStackSpacing: 5) { |