Multiple Windows Vision OS – Ios

by
Maya Patel
axios swiftui-ontapgesture vision-pro visionos

Quick Fix: For general reference, refer to [Apple’s documentation][1] on presenting Vision OS windows and spaces. You can achieve multiple windows without blurring if they don’t overlap, as shown in the attached screenshots. [1]: https://developer.apple.com/documentation/visionos/presenting-windows-and-spaces

The Solutions:

Solution 1: Non-overlapping Windows

To avoid the blurring effect on inactive windows in Vision OS, ensure that your windows do not overlap. This can be achieved by carefully positioning the windows or by using a layout system that automatically arranges the windows in a non-overlapping manner. Here’s a step-by-step guide to setting up multiple non-overlapping windows:

Step 1: Create a Window Group

  • Use VKCreateWindowGroup to create a window group that will contain all the windows.
  • This will allow you to set common properties and behaviors for all windows in the group.

Step 2: Create Windows

  • Create individual windows within the window group using VKCreateWindow.
  • Specify the desired position and size for each window.
  • Ensure that the windows do not overlap by carefully adjusting their positions.

Step 3: Set Window Properties

  • Use VKSetWindowProperty to set the desired properties for each window, such as title, background color, and visibility.
  • Set the VKWindowPropertyFlagsVisible property to true to make the window visible.

Step 4: Show Windows

  • Call VKShowWindow to display the windows on the screen.
  • The windows will be displayed according to their specified positions and sizes.

Step 5: Handle Window Interactions

  • Register for window events using VKAddWindowEventListener.
  • Handle window events such as clicks, drags, and resizes to enable interaction with the windows.

Step 6: Manage Window Focus

  • To keep all windows in focus, you can use the VKWindowPropertyFlagsFocusable property.
  • Set this property to true for all windows in the group.
  • This will allow the user to interact with any window without explicitly focusing it.

Q&A

How to prevent overlapping windows?

Make sure that the windows are not positioned in a way that they overlap each other.

How to achieve the same size and positioning?

Use the setFrame method to set the size and position of the window.

How to keep all windows in focus?

Use the setAlwaysOnTop method to keep the window always in focus, regardless of other windows.

Video Explanation:

The following video, titled "Build a visionOS Realtime Live Polls App | Multi Window | Apple ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

... Multi Window | Apple Vision Pro | Firestore. 3.1K views · 6 months ago #swiftui #applevisionpro #visionos ...more. Xcoding with Alfian. 7.84K.