Canvatorium Visio Lab 5035
SwiftUI Presentations in Volumes
As of June 2024 in the visionOS 2.0 Beta, presentations are not currently supported when using SwiftUI views in RealityView attachments.
Xcode returns the following error when trying to present this sheet when this view is hosted in a Volume.
Presentations are not currently supported in Volumetric contexts.
Until this is changed, we can’t use SwiftUI features such as Sheets, Pickers, Tooltips, etc.
I’m saving this lab as a quick place to check against future versions of visionOS.
struct Lab5035: View {
@State private var showingSheet: Bool = false
var body: some View {
VStack {
Text("Hello, World!")
Button("Show Sheet", action: {
showingSheet = true
})
}
.sheet(isPresented: $showingSheet) {
Text("some view")
}
}
}