There are some overlay tutorials on the Internet, all using
overlaySKScene at some point.
That is somehow not possible in my project, as (I guess) my v
The SpriteKit overlay goes on the SceneKit view, not on the SceneKit scene. This is a bit confusing because you're overlaying a scene on a view.
I see several possible error sources:
self.sceneView = MainScene(view: self.view))
as defined returns an SCNScene. You're assigning that to a property that expects an SCNView.
The line
scnView = view as! SCNView
will crash unless view returns a properly connected SCNView instance. But the init definition you've written expects a UIView.
Somewhere, you need to have your view be an SCNView. That view, because it conforms to protocol SCNSceneRenderer, will have an overlaySKScene property on it (overlaySKScene comes from that protocol, not from SCNView). That's where you can assign your SKScene instance.
If you have done that, then your code would look something like
scnView.scene = self
scnView.overlaySKScene = theSKScene
I have a simple example of an SKScene overlaid on an SCNView at https://github.com/halmueller/ImmersiveInterfaces/tree/master/Tracking%20Overlay
See also How do I create a HUD on top of my Scenekit.scene.