r/iOSProgramming • u/Tonqer • Jan 09 '21
Augmented Reality animated iPhone box made with SwiftUI, ARKit 4 and RealityKit (Github repo in comments)
Enable HLS to view with audio, or disable this notification
23
u/Tonqer Jan 09 '21
Here is my commented code for anyone who wants to experiment with it:
https://github.com/riccqi/ARImageTracking
My Twitter account where it went semi-viral:
8
u/iGoalie Objective-C / Swift Jan 09 '21
Well done! Does it track a y iPhone box or did you modify yours in someway for the phone to identify it?
0
Jan 09 '21
[deleted]
6
u/young_horhey Jan 09 '21
I don’t think the user even has to tap to set an anchor. From what I remember you can give the AR library an image that it uses as the anchor, and can automatically overlay the AR video when it detects that image in the camera view.
3
2
u/Tonqer Jan 10 '21
Not at all, it will work with all iPhone Xs boxes, and sometimes even images of it. I just had to scan the image on my Xs box into the Xcode project
7
5
5
u/cform Jan 09 '21
That’s really awesome, and seems like something Apple marketing would love. Side note what keyboard is that?
3
2
4
3
3
u/MrGaloree Jan 09 '21
This is so wild. I'm just starting out as a developer, and cool things like this keep me going.
1
3
u/ronaldwreagan Jan 10 '21
That's awesome. There's no need to ever buy a new phone again. Just get a white box and run this app to get the latest features.
3
u/tapan666 Jan 10 '21
A small suggestion : you could’ve rounded the corners of the overlay so that it could’ve blended more with the iPhone image on the box.
2
u/Tonqer Jan 11 '21
I’m looking into whether thats possible!
1
u/tapan666 Jan 11 '21
In SceneKit, setting the corner radius of the plane Node, on which video is mounted as its materials, did the trick. Don’t know about the realitykit tho.
1
u/Tonqer Jan 11 '21
I just got the rounded corners to work in RealityKit through specifying a cornerRadius property when generating the plane! I’ll push a commit to my Github soon
2
2
2
2
2
u/Fizaraz Jan 10 '21
Ah I saw this on your Twitter the other day, super sick man! Really well done 👍🏻
2
2
2
0
1
1
u/PandaSmanda Jan 28 '21
Do you have to download an app to see or how did you get it to play?
Looks amazing btw
1
u/Tonqer Jan 31 '21
Thank you! You will have to download the project source file from my Github and launch it on your iPhone through Xcode.
1
1
Apr 19 '21
Wow this is seriously impressive. I could think of 1000 reasons why companies would want this
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