Skip to content

Commit

Permalink
Merge branch 'update/prepare'
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielStormApps committed Mar 20, 2020
2 parents 8ee949b + d9cb692 commit e204665
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vibrator/Vibrator/Vibrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ public class Vibrator {
private init() {
guard supportsHaptics else { return }
hapticEngine = try? CHHapticEngine()
try? hapticEngine?.start()
}

/// Prepares the vibrator by acquiring hardware needed for vibrations.
public func prepare() {
guard let hapticEngine: CHHapticEngine = hapticEngine else { return }
try? hapticEngine.start()
}

// MARK: - Vibrate
Expand Down
1 change: 1 addition & 0 deletions vibrator/vibrator-demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// MARK: - UIApplicationDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Vibrator.shared.prepare()
return true
}

Expand Down

0 comments on commit e204665

Please sign in to comment.