You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lightweight and modular design, easy to integrate into any Swift project
Wide glTF specification support, covering materials, animations, cameras, and more
Optimized GPU resource management, enabling fast and efficient rendering on Apple platforms
Performance
SwiftGLTF has been tested using the official NodePerformanceTest model from the glTF Sample Assets, demonstrating the following performance results: This model contains:
10,000 nodes
10,000 meshes / primitives / materials
100 textures with randomized usage
Despite the extremely high node and material count, SwiftGLTF is capable of:
Maintaining a stable 60 FPS during rendering on supported Apple platforms
import SwiftGLTF
letgltfUrl= // URL to your glTF or GLB file
let gltfView =GLTFView(frame: view.frame)await gltfView.load(gltf: gltfUrl)
view.addSubview(gltfView)
SwiftUI
import SwiftGLTF
varbody:someView{@StateprivatevargltfUrl= // URL to your glTF or GLB file
GLTFSwiftUIView(url: gltfUrl)}
Supported glTF Features
Unsupported features are planned to be added in future updates.
File Formats
Format
Supported
glTF Binary (.glb)
✅
glTF JSON (.gltf)
✅
Buffer Formats
Format
Supported
External .bin file
✅
Embedded (data URI in .gltf)
✅
Image Formats
Format
Supported
PNG
✅
JPEG
✅
KTX2
❌
Mesh Compression
Extension
Supported
KHR_draco_mesh_compression
❌
PBR Materials (metallic-roughness)
Property
Supported
baseColorFactor
✅
baseColorTexture
✅
metallicFactor
✅
roughnessFactor
✅
metallicRoughnessTexture
✅
Additional Material Properties
Property
Supported
normalTexture
✅
occlusionTexture
✅
emissiveTexture
✅
emissiveFactor
✅
alphaMode
✅
alphaCutoff
✅
doubleSided
✅
extensions
✅ (see blow)
Supported Extensions for Materials
KHR_materials_transmission
KHR_materials_volume
KHR_materials_ior
KHR_materials_clearcoat
KHR_materials_specular
KHR_materials_sheen
KHR_materials_unlit
KHR_materials_variants
KHR_texture_transform
Vertex Attributes
Attribute
Supported
POSITION
✅
NORMAL
✅
TANGENT
✅
TEXCOORD_0
✅
TEXCOORD_1
✅
COLOR_0
✅
JOINTS_0
✅
WEIGHTS_0
✅
Node Hierarchy and Transforms
Feature
Supported
Node hierarchy
✅
matrix (4x4 transform matrix)
✅
translation / rotation / scale (TRS)
✅
Animation
Channel
Supported
translation
✅
rotation
✅
scale
✅
morph target weights
✅
Scenes
Feature
Supported
Multiple scenes
✅
Cameras
Feature
Supported
Perspective
✅
Orthographic
✅
Build
Sample Project
You can build the sample project by opening SwiftGLTFSample.xcodeproj.
Project Structure
SwiftGLTF
Provides GLTFView and GLTFMetalView components to display glTF files in UIKit and SwiftUI views.
SwiftGLTFRenderer
A library for rendering glTF files using Metal.
SwiftGLTFParser
A library that parses glTF and converts it into MDLAsset for use in Swift.
SwiftGLTFCore
A library that defines the core data structures of glTF.