Trying to Build an App for VisionOS (Kinosaki Onsen Workation Results Slides)

For a development retreat-style workation, I think the most important thing is not setting up the environment on site. Even when challenging a new technology, I want to set up the required environment and editor beforehand, and at least finish something like Hello World.
Long ago, at a past development retreat, there was someone who came with no preparation and ended up spending the time on installation and environment setup. If that is the goal, that is fine, but if you spend the thin shared connection at the venue downloading a huge SDK, for example, it may inconvenience other people.
This is the final, fourth installment of the Kinosaki Onsen workation series. Previous articles are here.
- I Joined the Kinosaki Onsen Workation Retreat
- The Inn and the Night at the Kinosaki Onsen Workation
- Morning Bath and Breakfast at the Kinosaki Onsen Workation
- Kinosaki Onsen Workation Results Slides, "Trying to Build an App for VisionOS" (this article)
Because this article introduces the results, it has a somewhat different flavor from the travelogue-like atmosphere of the previous entries.
As mentioned above, the M2 Mac mini I brought this time already had Xcode installed, the VisionOS simulator set up, and a Hello World-like app created. Conversely, since I had only just bought it, that minimal setup and environment preparation were about all I could do before departure.
On the Shinkansen on the way there, I could not exactly start up the Mac mini, so I only studied Swift UI on the 12-inch MacBook. However, iOS development, which has many similarities with VisionOS, is now difficult on this Mac. In the past, it was possible to develop iPhone apps on this machine, but with OS updates, Xcode updates, simulator updates, and so on, it has become heavy.
Still, there were things I could do in that situation. If it is a Mac app, the 12-inch MacBook is still practical enough. On top of that, Mac apps can actually be created with Swift UI too. So on the Shinkansen, I used the time to build a Mac app while learning Swift UI conventions.
I think Swift UI can be understood fairly quickly by people who have used SPA frameworks after React. One trend in modern SPA frameworks is the "declarative UI" paradigm, and that is also adopted in Swift UI. Application state is treated as data, and the view itself is managed as the result of a function that takes that data as an argument. When the data changes, the view also changes. That is the style.
In addition, Swift UI lets you define state with the easy-to-understand @State property. In React, you can do something similar with the useState hook, but its return value comes back as an array that can be hard to understand until you get used to it. In that sense, Swift UI even felt more refined and easier to understand.
Once you understand how state is managed, the rest is how to write the view. Although it is not an HTML tag format, the feeling of writing along the layout structure seemed like something you can quickly handle if you are used to other UI frameworks.
Up to this point was about understanding Swift UI. From there, I worked at the inn. VisionOS apps have several unique concepts. I spent some time understanding those. In particular, to make something behave as an AR or VR app, I needed to understand concepts such as shared space and full space.
If you are creating something like an iPhone app using Swift UI and placing it in space, you can create the application at the level of a Window. The code I had written on the Shinkansen could mostly be used as-is for this.
However, there are probably several key points worth understanding in VisionOS development, and I thought one of them was switching between shared space and full space. From a panel placed in space that can be written in Swift UI, the ImmersiveSpace scene, which lets you switch to a more immersive area, seemed like where VisionOS would probably show its greatest power. If I could learn how to handle that part, I felt this retreat would be a success.
So for this retreat, the goal became to create an application where simple panel-style content using Swift UI is placed in the air, and from there transitions to ImmersiveSpace, then present it.
For the presentation itself, I did it under the name "Yori Hiroi Frontend," and called my presentation slot "Yori Hiroi Frontend vol.00." I want to run several events this year too.
The results presentation was on the night of the second day, with the setup that all participants would present. I had prepared the slides by the afternoon of the second day, so during the presentation I talked for about 20 minutes while including the demo I had built and explanations of linked material. In reality, I may have talked for about 30 minutes. On that day, most people ended up speaking for a long time, but the topics covered various fields, so it was not boring. It was not only development topics, but also research, community topics, and activities people were working on.
However, on the night of the second day, after eating a large amount of Matsuba crab and drinking alcohol, there was a period when fighting sleepiness was hard. I was last in the presentation order, and by the end the alcohol had worn off, so I think I was able to give a meaningful presentation.
I cannot say even slightly that I understood the whole picture of VisionOS through this, but being able to grasp the development style and the overall development flow felt like a result that easily exceeded the participation fee. Incidentally, the venue was sponsored by kazamori. With deep gratitude and sincere thanks, I would like to conclude the articles on the Kinosaki Onsen workation retreat.
