Home » My First VisionOS Software. Learn some fundamentals of VisionOS | by Sung-Jie Hung 洪崧傑 | Aug, 2023

My First VisionOS Software. Learn some fundamentals of VisionOS | by Sung-Jie Hung 洪崧傑 | Aug, 2023

by Icecream
0 comment

Learn some fundamentals of VisionOS

Source: apple.com

I’ve been engaged on SwiftUI initiatives for some time, and I’m actually within the brand-new upcoming working system, visionOS. It makes use of frameworks like SwiftUI, RealityKit, and ARKit. I wish to mess around with it and construct a easy app for visionOS.

Discover VisionOS

Apple Vision Pro presents an infinite spatial canvas to discover, experiment, and play, providing you with the liberty to fully rethink your expertise in 3D.

Source: apple.com

Some key elements/blocks

Windows: You can create a number of home windows in your visionOS app. They’re constructed with SwiftUI and include conventional views and controls, and you may add depth to your expertise by including 3D content material.

Volumes: Add depth to your app with a 3D quantity. Volumes are SwiftUI scenes that may showcase 3D content material utilizing RealityKit or Unity, creating viewable experiences from any angle within the Shared Space or an app’s Full Space.

Spaces: By default, apps launch into the Shared Space, the place they exist facet by facet — very like a number of apps on a Mac desktop. Apps can use home windows and volumes to point out content material, and customers can reposition these components wherever they like.

Check out the official documentation to be taught extra.

Human Interface Guidelines for VisionOS

Source: apple.com

Characteristics and Patterns

  • Space: Apple Vision Pro presents a limitless canvas the place individuals can view digital content material like home windows, volumes, and 3D objects.
  • Immersion: People can fluidly transition between totally different ranges of immersion.
  • Passthrough: Passthrough supplies dwell video from the system’s exterior cameras and helps individuals work together with digital content material whereas seeing their environment.
  • Spatial Audio: Vision Pro combines acoustic and visual-sensing applied sciences to mannequin the sonic traits of an individual’s environment, mechanically making audio sound pure of their house.
  • Focus and gestures: People typically work together with Vision Pro utilizing their eyes and palms.
  • Ergonomics: People can stay at relaxation whereas partaking with apps and video games.
  • Accessibility: Apple Vision Pro helps accessibility applied sciences like VoiceOver, Switch Control, Dwell Control, Guided Access, Head Pointer, and plenty of extra.

Let’s construct our app!

I’ll construct a easy app that permits customers to decide on a 3D object from the listing and show it.

In the event course of, I found it’s nearly the identical as growing a SwiftUI app. If you’re accustomed to SwiftUI, you’re good to go!

Create an inventory

First, I create an inventory of 3D objects. Since I’m an enormous fan of the sport “League of the Legends,” I’ll use some 3D champions of the sport. This is nothing particular, only a listing of strings.

You will see an inventory of champion names on the left-hand facet. But don’t fear. In the following step, we’ll show the 3D mannequin on the right-hand facet. You ought to see one thing like this, isn’t it cool?

My Screenshot I

Find 3D fashions

You can discover some superb free 3D fashions on SketchFab. But if you wish to use your personal 3D fashions, you possibly can positively do this (Good luck 🤞). Make certain you export the 3D mannequin as a USDZ file (I assume Apple helps different codecs as nicely, however I’m not fairly certain about that).

Build the element view

Just like SwiftUI, we have to construct a element view to show the 3D mannequin. I’m going to make use of the 3D mannequin of champion “aatrox” for instance. You can take a look at the official doc to additional discover the APIs.

Isn’t it easy? We have to create a brand new view and add the 3D mannequin to it. You also can add some animations to the 3D mannequin. I’m not going to cowl that on this submit. You can take a look at the official doc to be taught extra.

You ought to see one thing like this. You can rotate the 3D mannequin by dragging it. You also can zoom in/out by pinching it.

My Screenshot II

And that’s it! Let’s put the whole lot collectively and watch the closing demo!

Final demo

That’s a wrap! Building an app for visionOS is just not that tough. If you’re accustomed to SwiftUI, you’re in a superb place. I’m wanting ahead to the official launch of VisionOS. I’m certain it will likely be a game-changer for the AR business. I hope you get pleasure from this submit. If you’ve gotten any questions, be at liberty to go away a remark under. Thank you for studying! 🎮

Check out all my weblog posts

Resources

You may also like

Leave a Comment