You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -68,6 +82,38 @@ All components used in RealityUI must be registered before they are used, simply
68
82
69
83
#### Activating Gestures
70
84
85
+
##### visionOS
86
+
87
+
With visionOS, gestures can be enabled on a RealityView using `View/addRUIDragGesture()` or `View/addRUITapGesture()` modifiers, or by adding the gestures directly with `.gesture(RUIDragGesture())` or `.gesture(RUITapGesture())`. The RealityView might look something like this:
88
+
89
+
```swift
90
+
RealityView { content in
91
+
let swtch =RUISwitch()
92
+
swtch.scale= .init(repeating: 0.1)
93
+
content.add(swtch)
94
+
}.addRUIDragGesture()
95
+
```
96
+
97
+
> The above snippet adds an interactive switch/toggle to the scene.
98
+
99
+
This gesture works for any entity with RUIDragComponent, for example:
100
+
101
+
```swift
102
+
RealityView { content in
103
+
let movable =try!awaitModelEntity(named: "toy_biplane")

114
+
115
+
##### iOS/macOS
116
+
71
117
Enabling RealityUI gestures can be doen by calling `RealityUI.enableGestures(.all, on: ARView)`, with `ARView` being your instance of an [ARView](https://developer.apple.com/documentation/realitykit/arview) object.
72
118
73
119
RUISlider, RUISwitch, RUIStepper and RUIButton all use ``RUIDragComponent``, which requires `.ruiDrag`. If you are adding elements that use the component `RUITapComponent` you can use the gesture `.tap`.
0 commit comments