Last active
August 24, 2017 11:30
-
-
Save saoudrizwan/db870c58646fe45aabade0ae7901d33e 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 UIKit | |
| let impactFeedbackGenerator: ( | |
| light: UIImpactFeedbackGenerator, | |
| medium: UIImpactFeedbackGenerator, | |
| heavy: UIImpactFeedbackGenerator) = ( | |
| UIImpactFeedbackGenerator(style: .light), | |
| UIImpactFeedbackGenerator(style: .medium), | |
| UIImpactFeedbackGenerator(style: .heavy) | |
| ) | |
| // Prepare shortly before playing | |
| impactFeedbackGenerator.light.prepare() | |
| impactFeedbackGenerator.medium.prepare() | |
| impactFeedbackGenerator.heavy.prepare() | |
| // Play the haptic signal | |
| impactFeedbackGenerator.heavy.impactOccurred() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment