Created
February 15, 2021 09:43
-
-
Save nthState/f022f6c73b6e06f40b99b6260d44db99 to your computer and use it in GitHub Desktop.
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 | |
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) | |
} catch { | |
print("play error: \(error)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment