ViewController
import UIKit
import SceneKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let scnView = self.view as SCNView
scnView.backgroundColor = UIColor.blackColor()
let sizeScnView = CGSize(width: 100.0, height: 100.0)
let centerView = CGPoint(x: CGRectGetMidX(self.view.frame) - sizeScnView.width/2, y: CGRectGetMidY(self.view.frame) - sizeScnView.height/2)
let scene = Tile(frame: CGRect(origin: centerView, size: sizeScnView))
scnView.scene = scene
}
}
Tile
import UIKit
import SceneKit
class Tile: SCNScene {
override init() {
super.init()
let ball = SCNSphere(radius: 0.5)
let ballNode = SCNNode(geometry: ball)
ball.firstMaterial?.diffuse.contents = UIColor.orangeColor()
self.rootNode.addChildNode(ballNode)
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Just reading this article do not know if the Question is still open I am running this in a small test seems to work fine