Hi all, I'm trying to create a simple 3d application using RealityKit but for some reason in XCode project this code yield error
let arView = ARView(frame: .zero, cameraMode: .nonAR, automaticallyConfigureSession: true)
saying :
- Cannot infer contextual base in reference to member 'nonAR'
- Extra arguments at positions #2, #3 in call
Basically suddenly the project won't except the other way to initialize ARView. This is confusing because I tried on Swift Playground and it works fine!
I've tried updating my XCode, clean install and even tried on several macbooks but still the same. Looking up at the documentation and there doesn't seem any information regarding this being deprecated or changed.
So here's a funny thing, this code totally works on Swift Playground for Mac but it doesn't work on Playground on XCode :
import PlaygroundSupport
import RealityKit
let arView = ARView(frame: .zero, cameraMode: .nonAR, automaticallyConfigureSession: true)
let point = PointLight()
point.light.intensity = 1000
let lightAnchor = AnchorEntity(world: [0,0,0])
lightAnchor.addChild(point)
arView.scene.addAnchor(lightAnchor)
let textMesh = MeshResource.generateSphere(radius: 0.5)
let material = SimpleMaterial(color: .white, isMetallic: false)
let entity = ModelEntity(mesh: textMesh, materials: [material])
let anchor = AnchorEntity(world: [0,0.25,0])
anchor.addChild(entity)
arView.scene.addAnchor(anchor)
let camera = PerspectiveCamera()
let camAnchor = AnchorEntity(world: [0,0,5])
camAnchor.addChild(camera)
arView.scene.addAnchor(camAnchor)
PlaygroundPage.current.setLiveView(arView)
Help?? Any idea?