On visionOS, I have discovered that if dismissWindow is followed immediately by a call to openWindow, the new window does not open where the user is looking at. Instead, it appears at the same location as the dismissed window. However, if I open the new window after a small delay, or after UIScene's willDeactivateNotification, the new window correctly opens in front of the user. (I tested this within a opened immersive space.)
Does this imply that dismissWindow is actually asynchronous, in the sense that it requires extra time to reset certain internal states before the next openWindow can be called? What is the best practice to close a window, then open a new window in front of the user's current head position?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
We have discovered that our UIViewRepresentable view isn't being dismantled after its window is dismissed via dismissWindow().
This seems to result in a leak of our custom Coordinator class. Every time the user opens a new window, a new Coordinator is created; if the user then dismisses the window manually, or we dismiss it programmatically, the Coordinator remains in memory with no way to destroy it.
Is this expected behavior? How can we be sure to clean up our Coordinator when the view's window is closed? Thanks.
Take this piece of code for example:
Menu {
...
} label: {
Image(systemName: "ellipsis.circle")
.resizable()
.foregroundStyle(Color.primary)
.frame(width: 24, height: 24)
.contentShape(.circle)
.padding(.spacing8)
.glassEffect(.regular.interactive(), in: .circle)
}
.tint(nil)
When tapped, the interactive liquid glass effect expands in response, but the expanded glass is then clipped by the original bounds of the view. In this example, the button would briefly show up as a highlighted square due to the clipping.
If I add enough padding around the Menu's label, the expanded glass effect is be able to show unclipped, but this feels like a hack.
Is this a bug in the framework, or am I doing something wrong? I have submitted FB19801519 with screen recording and demo project.