Tutorial
Building Your First visionOS App with Aug
January 10, 2025
12 min read
Sarah Chen
Developer Advocate
In this tutorial, we'll build a simple 3D object viewer from scratch using the Aug framework.
Prerequisites
- Xcode 15.0 or later
- visionOS SDK
- Aug framework (sign up for beta access)
Project Setup
First, create a new visionOS project in Xcode:
bash
1xcodebuild -project MyApp.xcodeproj -scheme MyApp -destination 'platform=visionOS Simulator,name=Apple Vision Pro'Adding Aug
Install Aug via Swift Package Manager:
swift
1dependencies: [
2 .package(url: "https://github.com/augmentedruntime/aug.git", from: "1.0.0")
3]Creating Your First View
Let's create a simple spatial view that displays a 3D model:
swift
1import SwiftUI
2import RealityKit
3import Aug
4
5struct ContentView: View {
6 var body: some View {
7 AugmentedSpace {
8 SpatialView {
9 Model3D(named: "robot") {
10 Text("Loading...")
11 } placeholder: {
12 ProgressView()
13 }
14 .frame(depth: 300)
15 .offset(z: -500)
16 }
17 }
18 }
19}Adding Interactions
Now let's add gesture support:
swift
1Model3D(named: "robot")
2 .gesture(.spatialTap) { location in
3 print("Tapped at: \(location)")
4 }
5 .gesture(.spatialDrag) { translation in
6 // Handle drag
7 }
8 .gesture(.spatialRotate) { rotation in
9 // Handle rotation
10 }Next Steps
You've built your first spatial computing app with Aug! Try experimenting with:
- Different 3D models
- Multiple spatial views
- Hand tracking gestures
- Spatial audio integration
Enjoyed this article?
Share it with your network and subscribe for more insights.