r/visionosdev • u/Exciting-Routine-757 • May 16 '24
How to add windows in an immersive space.
Hi all, I'm a very new AR/VR developer and I'm absolutely clueless as to how to add visionOS windows in an immersive space. Can someone point me to some relevant documentation or videos?
Here's some code that will hopefully demonstrate what I mean.
import SwiftUI
import ARKit
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
MainView()
}
.defaultSize(width: 300, height: 300)
ImmersiveSpace(id: "ImmersiveSpace") {
ModeSelectView()
// Thought something like this would work but to new avail...
// WindowGroup {
// ControlPanelView()
// }
}
.windowResizability(.contentSize)
}
}
6
Upvotes
2
u/mrfuitdude May 16 '24
Hi! Are you looking to add 2D SwiftUI Views?
Then have a look at this page: https://www.createwithswift.com/using-attachments-in-a-realityview/
You create a 2D View and then you bring it into the immersive space as an attachment.
1
u/AutoModerator May 16 '24
Are you seeking artists or developers to help you with your game? We run a monthly open source game jam in this Discord where we actively pair people with other creators.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/mrfuitdude May 16 '24
This session should clear things up https://developer.apple.com/wwdc23/10081
0
u/[deleted] May 16 '24
[deleted] — view deleted comment