Skip to content

Instantly share code, notes, and snippets.

@kravik
Created August 17, 2017 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kravik/2843b29463ff8905f1bb69e0b081f240 to your computer and use it in GitHub Desktop.
Save kravik/2843b29463ff8905f1bb69e0b081f240 to your computer and use it in GitHub Desktop.
init_arkit.swift
import UIKit
//1
import ARKit
import SceneKit
class ViewController: UIViewController {
//2
lazy var sceneView: ARSCNView = {
let view = ARSCNView(frame: CGRect.zero)
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
//3
view.addSubview(sceneView)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
//4
sceneView.frame = view.bounds
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//5
let configuration = ARWorldTrackingConfiguration()
sceneView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment