r/iOSProgramming • • Jan 09 '21

Augmented Reality animated iPhone box made with SwiftUI, ARKit 4 and RealityKit (Github repo in comments)

923 Upvotes

43 comments sorted by

View all comments

45

u/danen_ Jan 09 '21

Nice, it looks so smooth. In my beginnings of iOS dev I’ve used the image tracking that ARKit is offering but it wasn’t so smooth like on the video. Is it something that RealityKit offers? I was pretty much hyped for the ARKit at the beginning but later due to the work responsibilities I haven’t been reading about the new stuffs about it. Also another question, why are you using SwiftUI? As I can see there isn’t any UI element on your app

9

u/Tonqer Jan 09 '21

To my knowledge, the older SceneKit framework offers about the same tracking ability as RealityKit does. So it could be just general advancements to ARKit. I used SwiftUI because I wanted to try out working with SwiftUI's Coordinators and UIView wrappers; perhaps it can be adapted into a SwiftUI app someday

7

u/RadicalBond Jan 09 '21

Yeah I believe both SceneKit and RealityKit rely on ARKit to do the actual tracking (RK uses ARKit internally but for SK you have to explicitly import it.) SK and RK do the rendering.

It’s been my experience, and Apple has said as much at WWDC, that AR tracking has been improving a lot, especially on newer phones and in good lighting. The LIDAR sensor helps but not as much as you would think. It helps the most in low light (e.g. it makes testing a lot easier because you can just do it right at your desk instead of having to go outside or into a very brightly lit room.)

1

u/Tonqer Jan 10 '21

Yup, this was recorded on a regular iPhone 12 with no LIDAR

1

u/danen_ Jan 09 '21

Maybe it’s because of my device (8+). I remember when I was trying the image tracking if I moved it quickly the tracking was interrupted and it wasn’t nearly smooth as on the video of this post. Anyway AR was always interesting for me but now with the work responsibilities I don’t have that much energy and hype for trying something new, or maybe that’s some excuse from my side

1

u/Tonqer Jan 10 '21

Go for it man! The tracking still gets lost sometimes on the iPhone 12 I was screen recording this on, but only at odd angles and bad lighting.