SceneViewSwift

April 12, 2026 · View on GitHub

3D and AR scenes in SwiftUI, powered by RealityKit. The Apple companion to SceneView for Android.

iOS 18+ macOS 15+ visionOS 1+

Installation

Add SceneViewSwift via Swift Package Manager:

  1. In Xcode, go to File > Add Package Dependencies...
  2. Enter the repository URL:
    https://github.com/sceneview/sceneview-swift
    
  3. Select the version rule and add the package to your target.

Or add it to your Package.swift:

dependencies: [
    .package(url: "https://github.com/sceneview/sceneview-swift", from: "3.6.0")
]

Quick Start

3D Model Viewer

import SwiftUI
import SceneViewSwift

struct ModelViewer: View {
    @State private var model: ModelNode?

    var body: some View {
        SceneView { content in
            if let model {
                content.addChild(model.entity)
            }
        }
        .environment(.studio)
        .cameraControls(.orbit)
        .autoRotate()
        .task {
            model = try? await ModelNode.load("robot.usdz")
        }
    }
}

AR Tap-to-Place

import SwiftUI
import SceneViewSwift

struct ARPlacement: View {
    @State private var model: ModelNode?
    @State private var placedEntities: [Entity] = []

    var body: some View {
        ARSceneView(
            planeDetection: .horizontal,
            onTapOnPlane: { position in
                if let model {
                    let clone = model.entity.clone(recursive: true)
                    clone.position = position
                    // Add to AR scene
                }
            }
        )
        .task {
            model = try? await ModelNode.load("chair.usdz")
        }
    }
}

Procedural Shapes with PBR

SceneView { root in
    let metal = GeometryNode.sphere(
        radius: 0.3,
        material: .pbr(color: .gray, metallic: 1.0, roughness: 0.1)
    )
    .position(.init(x: 0, y: 0.3, z: 0))
    .withGroundingShadow()
    root.addChild(metal.entity)
}
.environment(.sunset)

Lights

let sun = LightNode.directional(color: .warm, intensity: 1000, castsShadow: true)
    .lookAt(.zero)

let lamp = LightNode.point(color: .custom(r: 1, g: 0.5, b: 0), intensity: 500)
    .position(.init(x: 1, y: 2, z: 0))

3D Text & Billboards

// Always faces camera
let label = BillboardNode.text("Player 1", fontSize: 0.04)
    .position(.init(x: 0, y: 1.5, z: 0))

// 3D extruded text
let title = TextNode(text: "SceneView", fontSize: 0.08, depth: 0.02)
    .centered()

API Reference

Views

TypeDescription
SceneView3D scene with orbit camera, lighting, and gestures
ARSceneViewAR scene with plane detection and tap-to-place

Nodes

TypeDescription
ModelNodeUSDZ model loading with animations and collision
GeometryNodeProcedural shapes (cube, sphere, cylinder, cone, plane)
MeshNodeCustom mesh geometry from raw vertex data
ShapeNode2D polygon shapes (flat or extruded) with ear-clipping triangulation
TextNode3D extruded text with centering
BillboardNodeAlways-faces-camera wrapper
LineNodeLine segments and axis gizmos
PathNodeClosed and open 3D paths with customizable geometry (circle, grid helpers)
LightNodeDirectional, point, and spot lights
CameraNodeProgrammatic camera control with orbit, fly-through, and custom modes
ImageNodeDisplay images on 3D planes with automatic aspect ratio
VideoNodePlay video content on 3D surfaces with playback controls
PhysicsNodeApply physics simulation (dynamic, static, kinematic) to entities
DynamicSkyNodeTime-of-day sun positioning with atmospheric color model
FogNodeAtmospheric fog (linear, exponential, height-based)
ReflectionProbeNodeLocal cubemap reflections for realistic surfaces
AnchorNodeAR world/plane anchor
AugmentedImageNodeDetect real-world images and place 3D content (iOS only)

Configuration

TypeDescription
SceneEnvironment6 HDR presets: studio, outdoor, sunset, night, warm, autumn
CameraControlsOrbit camera with inertia and auto-rotation
GeometryMaterialPBR material: .simple, .pbr, .unlit

Platform Mapping (Android ↔ iOS)

Android (Compose)iOS (SwiftUI)
SceneView { }SceneView { root in }
ARSceneView { }ARSceneView()
rememberModelInstanceModelNode.load()
CubeNodeGeometryNode.cube()
SphereNodeGeometryNode.sphere()
ShapeNodeShapeNode(points:)
LightNode(apply = { })LightNode.directional()
rememberEnvironment.environment(.studio)
CameraManipulatorCameraControls

Example App

See Examples/SceneViewDemo/ for a full 4-tab demo:

  • Explore -- 3D viewer with orbit camera and 6 HDR environments
  • Shapes -- All primitive shapes with live previews and code snippets
  • AR -- Tap-to-place objects on real surfaces
  • About -- SDK information and feature list

License

Apache 2.0. See LICENSE for details.