Install GLTFSceneKit via Carthage
masterAdd the following line to your Cartfile to use Carthage for dependency management.
github "magicien/GLTFSceneKit" ~> 0.4.0repository·master·Indexed 43 days ago
https://github.com/magicien/gltfscenekitA glTF loader for Apple's SceneKit framework that allows developers to import glTF assets into SCNScene objects for use on iOS, macOS, and other Apple platforms. Supports installation via CocoaPods, Carthage, and Swift Package Manager.
Add the following line to your Cartfile to use Carthage for dependency management.
github "magicien/GLTFSceneKit" ~> 0.4.0To install using Swift Package Manager (SPM):
File > Swift Packages > Add Package Dependency....https://github.com/magicien/GLTFSceneKit in the search box and click Next.Add GLTFSceneKit to your Podfile to manage the dependency using CocoaPods.
pod 'GLTFSceneKit'Use GLTFSceneSource to load a glTF file from your project assets and convert it into an SCNScene.
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
}Use GLTFSceneSource with initWithURL:options: to initialize a source from a URL, then call sceneWithOptions:error: to generate the SCNScene.
@import GLTFSceneKit;
GLTFSceneSource *source = [[GLTFSceneSource alloc] initWithURL:url options:nil];
NSError *error;
SCNScene *scene = [source sceneWithOptions:nil error:&error];
if (error != nil) {
NSLog("@%@", error);
return;
}