I did a quick test.
The class stuff that the apple doc says will be auto created do not seem to be when dropping the .rcproject in to one of the examples I made earlier to show postMessage.
So I added a new class file with:
import UIKit
import RealityKit
class ViewController: UIViewController {
@IBOutlet var arView: ARView!
override func viewDidLoad() {
super.viewDidLoad()
// Load the "Real" scene from the "Mtest" Reality File
let boxAnchor = try! Mtest.loadReal()
// Add the box anchor to the scene
arView.scene.anchors.append(boxAnchor)
}
}
note the vr scene is named Real which is named via the scenes side bar in Reality Composer.
Where the line let boxAnchor = try! Mtest.loadReal() . in the code above uses that name.
loadReal()
Mtest is the file name
( you removed your link to your file so I could not use that which would probably make things clearer in the above code.)
I then added a new storyboard file and composed a RealityKit AR View and linked it up to the ViewController class’s @IBOutlet var arView: ARView!.
I also gave the scene a Storyboard ID of realv ( via the class inspector )
In the wkwebview controller.
I used this code. ( again just an example and not verified as the correct coding )
if message.name == "openStore" {
print("\(message.body )")
//-- Get the message passed to app
let storyBoard: UIStoryboard = UIStoryboard(name: "realv", bundle: nil)
let balanceViewController = storyBoard.instantiateViewController(withIdentifier: "realv") as! ViewController
self.present(balanceViewController, animated: true, completion: nil)
}
change and reference the actual postMessage name you use. But here I just used openStore.
lastly i added the property Privacy - Camera Usage Description to the info plist file in the Xcode project. ( this asks the user to give access to the camera)
This post gave me some of the clues of where to head.
What this gives me is a modal that keeps the VR in the App. ( can be dismissed by dragging it down )
You will need to research a bit on how to set this up properly and cleanly though.