GLTFSceneKit
glTF loader for SceneKit
Installation
CocoaPods
UsingAdd the following to your Podfile:
pod 'GLTFSceneKit'
Carthage
UsingAdd the following to your Cartfile:
github "magicien/GLTFSceneKit" ~> 0.4.0
Swift Package Manager
Using- Open your project with Xcode
- Select
File
>Swift Packages
>Add Package Dependency...
- Put
https://github.com/magicien/GLTFSceneKit
in the search box and clickNext
Usage
Swift
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
}
Objective-C
@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;
}
See also
GLTFQuickLook - QuickLook plugin for glTF files