I am trying to return a SceneView from a DeviceActivityReport. I have my DeviceActivityReportExtension correctly set up and I am able to display a view with text or other UI elements in it, but attempting to return a SceneView as part of the body
just won't display. I have this example. When I display this SceneView in my main app, it displays correctly. When I put the same code inside the DeviceActivityReportExtension, the scene does not show up and an error failed to create a gl context
appears repeatedly in the console. I'm pretty stumped and would appreciate any suggestions.
import SwiftUI
import SceneKit
struct TestScene: View {
var scene: SCNScene? {
SCNScene(named: "art.scnassets/environment.scn")
}
var cameraNode: SCNNode? {
let cameraNode = SCNNode()
cameraNode.camera = SCNCamera()
cameraNode.position = SCNVector3(x: 0, y: 0, z: 2)
return cameraNode
}
var body: some View {
SceneView(
scene: scene,
pointOfView: cameraNode,
options: [
.allowsCameraControl,
.autoenablesDefaultLighting,
.temporalAntialiasingEnabled
]
)
}
}