Member-only story

How to Use a SwiftUI View in an ARKit and SceneKit App

Bringing SwiftUI into AR

Sarang Borude
Better Programming
8 min readApr 11, 2020

--

Photo by Olivier Miche on Unsplash

AR apps have a lot of 3D elements and Apple has provided great tools to build awesome AR apps, like Reality Kit and Reality Composer. But sometimes you just need to show a simple UI on the screen. Apple gave us SwiftUI at WWDC 2019, and it is an amazing way to quickly make UIs in your app.

In this post, we are going to look into how we can show a SwiftUI view in an ARKit app. We will not be looking into how to do this in a Reality Kit app (maybe in a future post), but for this post, we will be focussing on SceneKit as our content technology.

To keep it simple, I am not doing a world tracking configuration app, rather, I will make an app with image tracking configuration so we can focus more on showing the SwiftUI view.

If you want to be explorative, please, by all means, create a world tracking app, track horizontal and vertical planes, do some hit tests, and show the amazing SwiftUI views you create on the walls around you.

By the end of this post, you will have an app that tracks an Image Marker and renders a SwiftUI view on top of it.

Let's get started. I am using XCode version 11.4.

Create a New Project in XCode

--

--

Sarang Borude
Sarang Borude

Written by Sarang Borude

Making the future of mobility better @ Volkswagen Group of America, iOS Developer, UX prototyper, XR Enthusiast

Responses (4)

Write a response