callstack / react-native-visionos

A framework for building native visionOS applications using React
https://callstack.github.io/react-native-visionos-docs/
MIT License
1.02k stars 30 forks source link

Setup SwiftUI as the entry point #45

Closed okwasniewski closed 10 months ago

okwasniewski commented 12 months ago

Description

To allow for visionOS specific APIs we need to setup SwiftUI as the entry point to visionOS apps.

The idea is to have UIViewRepresentable holding react native root view which would allow us to use: ImmersiveSpaces, volumetric windows and ornaments

derwaldgeist commented 10 months ago

I was just going to ask this. We're devloping a fully immersive AR app. In our case, the best combination would be to have the opportunity to use SwiftUI alongside React Native, so one can profit from both technologies.

(I used Cordova in the past, not React Native, and there were always cases where the only solution would have been to integrate some native UX or plugins. I know React Native is a different beast, and as our server is React-based anyways, I'm evaluating this approach right now. But I don't want to do compromises when it gets to UX, especially on the Vision Pro.)

Thanks for taking action on this integration. It's looking great. We're currently using Unity as our toolset, so I know that they're having a hard time to make visionOS support possible.

BTW: What would be your approach to integrate RealityKit Pro content? I'd love to see an example how this could be accomplished, and how you can switch between Shared Space and Full Immersive Space. Exciting times ahead :)

okwasniewski commented 10 months ago

Hey @derwaldgeist,

Using ImmersiveSpaces and RealityKit content is our primary goal of making SwiftUI as the root in React native visionOS. Here is a demo of going into Immersive Space while displaying a USDZ Model (SwiftUI's RealityView). I'm hoping to get this change released soon and allow users to experiment with it. I'm planning to also write a blog post about this type of SwiftUI integration.

https://github.com/callstack/react-native-visionos/assets/52801365/bbed6027-f3fe-4415-a715-2311eb3116ce

derwaldgeist commented 10 months ago

Woah, that's amazing! Great work, guys. Love it.

I guess you're using volumes here, right? But it would be possible to place content arbitrarily in space?

okwasniewski commented 10 months ago

@derwaldgeist Sorry I missed your response. Yes it will be possible to place content everywhere same as in native apps (as RealityKit capabilities are the only limit here).

SwiftUI entrypoint is now on main branch, so I'm closing this issue.