Created
June 25, 2021 09:18
-
-
Save nthState/cb6d4314ade70a07939f89344264ba90 to your computer and use it in GitHub Desktop.
Play Haptics with Syncing to Haptrix macOS App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CoreHaptics | |
import HaptrixSync | |
func playHapticsFile() { | |
guard let url = Bundle.main.url(forResource: "myfile", withExtension: "ahap") else { | |
print("could not load file") | |
return | |
} | |
do { | |
let engine = try? CHHapticEngine() | |
try engine?.playPattern(from: url, syncUpdates: true) | |
} catch { | |
print("play error: \(error)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment