Using digital crown on Vision Pro Simulator

Hi

Is anyone aware of a way to emulate the digital crown within the Vision Pro Simulator? I've tried various key/scrolling combinations without any luck.

I am interested to see how the progressive immersion mode works.

Thanks

Answered by JChunyu in 768105022

Simulator menu in mac status bar,I/0 -> Set Immersion To

I have been trying the same thing. Could not find in the options.

Same here!

The release notes for Xcode 15 beta 2 (https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes) say that a GUI-based emulation of the crown is a missing feature, and that the workaround is to emulate it yourself using in-software function calls.

  • There is no UI for simulating Apple Vision Pro’s immersion crown. (109429267)

Workaround: Use XCTest’s XCUIDevice. rotateDigitalCrown(delta:) method.

/*!
 * Rotate the digital crown by a specified amount.
 *
 * @param rotationalDelta
 * The amount by which to rotate the digital crown. A value of 1.0 represents one full rotation.
 * The value’s sign indicates the rotation’s direction, but the sign is adjusted based on the crown’s orientation.
 * Positive values always indicate an upward scrolling gesture, while negative numbers indicate a downward scrolling gesture.
 *
 */
- (void)rotateDigitalCrownByDelta:(CGFloat)rotationalDelta;

PROBLEM: I can't figure out how to use the function. Xcode reports that the library does not exist when I run the application within the simulator. Maybe it's not currently possible.

The function that @KTRosenberg showed is available on XCUIDevice. Take a look at the documentation here: https://developer.apple.com/documentation/xctest/xcuidevice

Use the XCUIDevice shared instance to perform the following interactions with a simulated iOS, watchOS, or tvOS device during a UI test: Press the volume and Home buttons. Rotate the device. Turn the Digital Crown on a watchOS device. Determine whether the iOS device supports pointer interaction. Activate Siri.

You can import XCTest and then create a variable of type XCUIDevice to access the function. Documentation on the function is here: https://developer.apple.com/documentation/xctest/xcuidevice/3784679-rotatedigitalcrown

per https://developer.apple.com/videos/play/wwdc2023/10111, there is mention of being able to control immersion through our app. so perhaps instead of relying on crown change, we can implement a slider to set something stateful that will alter our app's immersion depth.

Am I correct that XCTest is only usable in code testing? If so, how exactly would we simulate this during development? While models from Reality Composer Pro show up, their display is near identical to Mixed.

How does one build a skybox or other objects which replace the user's room? Apologies for so many questions. The documentation seems to lack nuance on how to build much beyond making a model show up on a table.

ImmersiveSpace(id: "ImmersiveSpace") {
    ImmersiveView()
}.immersionStyle(selection: .constant(.full), in: .full)

Simulator menu in mac status bar,I/0 -> Set Immersion To

Hello,

@JChunyu is correct, you can set the immersion level:

Simulator menu in mac status bar,I/0 -> Set Immersion To

Some of you have mentioned that this menu is disabled for you, I am adding a clarification that we only expect it to be enabled if the immersion style of your immersive space is progressive. In all other cases, we expect it to be disabled.

Best regards,

Greg

Using digital crown on Vision Pro Simulator
 
 
Q