Swiftpack.co - rkaehn/SCNGestureController as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by rkaehn.
rkaehn/SCNGestureController 1.1.0
Easy-to-use, cross-platform gestures for SceneKit
⭐️ 2
🕓 4 weeks ago
iOS macOS
.package(url: "https://github.com/rkaehn/SCNGestureController.git", from: "1.1.0")


swift version platforms platforms

This package makes it extremely fast and easy to add gestures to your SceneKit project. Gestures can be added to a SCNView or SCNNode and work on iOS and macOS.

🚀 Getting Started

These instructions will get you up and running in no time!

📋 Prerequisites

💻 Installation

This package is available for iOS 12 or newer and macOS 10.13 or newer and can be installed easily via Swift Package Manager.

Just extend your Package.swift file with the following lines:

dependencies: [
    .package(url: "https://github.com/rkaehn/SCNGestureController", .upToNextMajor(from: "1.0.0"))

📝 Code Examples

Before you can use the gestures, you need to attach the gesture controller to your SCNView. This can be done with the following lines of code:

import SCNGestureController

let gestureController = SCNGestureController.shared

That was it! Now you can add a gesture to a SCNNode like this:

let box = SCNNode(geometry: SCNBox())

box.onTap { (tapGesture) in
    print("Box tapped!")

You can also use the state of the gesture like this:

box.onRotation { (rotationGesture) in
    switch rotationGesture.state {
    case .began, .changed:


Stars: 2
Last commit: 4 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics