In my project, I started using the GLTFSceneKit package to load models. It works perfectly, but there is a method that causes the UI to freeze for 1-2 seconds, and then everything continues.
The code is as follows:
import GLTFSceneKit
var scene: SCNScene
do {
let sceneSource = try GLTFSceneSource(named: "art.scnassets/Box/glTF/Box.gltf")
scene = try sceneSource.scene()
} catch {
print("\(error.localizedDescription)")
return
}
I noticed that the scene = try sceneSource.scene() line is responsible for the freeze.
How can I fix it so that the app doesn't freeze when it gets to this line of code?