Mobile Development 6 min read

Getting Started with ARKit: Building an Augmented Reality App in Xcode 9

This tutorial introduces Apple’s ARKit platform introduced at WWDC 2017, explains the required hardware and iOS version, walks through creating an Augmented Reality App project in Xcode 9, importing 3D models, configuring plane detection, and rendering a virtual cup on a detected horizontal surface using ARSCNView.

Hujiang Technology
Hujiang Technology
Hujiang Technology
Getting Started with ARKit: Building an Augmented Reality App in Xcode 9

At WWDC 2017 Apple introduced iOS 11 with ARKit, a new augmented reality platform that integrates camera and motion detection to enable AR experiences.

ARKit provides device motion tracking, camera scene capture, and advanced scene processing, simplifying the creation of AR user experiences.

To run ARKit projects you need an iPhone 6s or newer with iOS 11, as it requires A9/A10 processors.

In Xcode 9 you can create a new "Augmented Reality App" project, which automatically adds the <SceneKit/SceneKit.h> and <ARKit/ARKit.h> frameworks and includes an art.scnassets folder for model resources.

You can use the default SCN model or import DAE models created in 3DMax; after adding them to the scnassets folder you may need to assign textures manually.

To convert a DAE file to SCN, select the file in Xcode, click the "Category" bit, choose "Convert", and Xcode will generate the SCN version.

The main view controller uses ARSCNView , a subclass of SCNView , to render the AR scene. ARSCNView displays 3D content, while ARSKView displays 2D SpriteKit content.

To place a virtual cup on a detected horizontal plane, configure an ARWorldTrackingSessionConfiguration with planeDetection = ARPlaneDetectionHorizontal , then in the renderer:didAddNode:forAnchor: delegate method create a plane node and load the cup model from the scene assets.

The provided demo (https://github.com/spykerking/TestARKit.git) and the official documentation for SceneKit and ARKit are linked for further reference.

mobile developmentiOSXcodeaugmented realityArkitSceneKit
Hujiang Technology
Written by

Hujiang Technology

We focus on the real-world challenges developers face, delivering authentic, practical content and a direct platform for technical networking among developers.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.