A playground project exploring how to embed Spline 3D scenes into SwiftUI applications using Spline's native runtime. This demo combines device motion sensors with interactive 3D scenes for a fun, immersive experience.
This is an experimental project that demonstrates integrating Spline's native iOS runtime with SwiftUI. The app uses CoreMotion to track your device's accelerometer data and translates it into real-time 3D object rotations in a Spline scene. Tilt your device to control the 3D scene interactively!
Want to learn more about Spline's Code API for SwiftUI? Check out the official documentation.
This project demonstrates two ways to embed Spline scenes in your SwiftUI app:
- Cloud Embedding: The app currently loads the scene from Spline's cloud service (see
ContentView.swift) - Offline Embedding: You can also bundle the scene file locally for offline use
The original .spline scene file is included in the spline scene/ folder. You can:
- Import it to Spline: Sign up at app.spline.design and import the
.splinefile to edit and customize the scene - Get a copy online: Access the scene here
- 🎮 Real-time gyroscope/accelerometer integration
- 🎨 Interactive 3D Spline scenes
- 📱 Smooth motion tracking with exponential smoothing
- 🖼️ Full-screen immersive experience
- iOS 26.0 or later (didn't test on older devices)
- Xcode 26.0 or later
- A physical iOS device (motion sensors don't work in the simulator)
- Open
gyrospline.xcodeprojin Xcode - Install dependencies (SplineRuntime should be managed via Swift Package Manager)
- Connect your iOS device and select it as the build target
- Build and run the project (⌘R)
Note: You'll need a physical iOS device to test the motion sensors, as they don't work in the simulator.
- Launch the app on your iOS device
- Hold your device and tilt it in different directions
- Watch as the 3D scene responds to your device's orientation in real-time
- SwiftUI - Modern UI framework
- SplineRuntime - Spline's native iOS runtime for 3D scene rendering
- CoreMotion - Motion sensor access
- Combine - Reactive programming
- Spline Code API for SwiftUI Documentation - Official guide for integrating Spline scenes into SwiftUI apps
This project is licensed under the MIT License.
Gábor Pribék
Made with ❤️ using SwiftUI and Spline
