Created
June 24, 2026 10:41
-
-
Save jacobsapps/449a2f7e8be7e82d8d27945705f4ae2f to your computer and use it in GitHub Desktop.
Haptics from My top 3 design “Kisses” I like to add to every 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
| func playAHAP(_ name: String) { | |
| guard | |
| let engine = try? CHHapticEngine(), | |
| let url = Bundle.main.url(forResource: name, withExtension: "ahap") | |
| else { return } | |
| try? engine.start() | |
| let player = try? engine.makePlayer(with: CHHapticPattern(contentsOf: url)) | |
| try? player.start(atTime: CHHapticTimeImmediate) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment