Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

iPhone: Taptic & Audio Feedback #4

Open
rldaulton opened this issue Apr 17, 2018 · 0 comments
Open

iPhone: Taptic & Audio Feedback #4

rldaulton opened this issue Apr 17, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@rldaulton
Copy link
Owner

Taptic Engine

Use an enum to add some taptic engine functionality to small feature points throughout the app:

public enum Vibration {
      case Light
      case Medium
      case Heavy
  
      @available(iOS 10.0, *)
      func hapticFeedback() -> UIImpactFeedbackGenerator {
          switch self {
          case .Heavy:
              return UIImpactFeedbackGenerator(style: .heavy)
          case .Medium:
              return UIImpactFeedbackGenerator(style: .medium)
          case .Light:
              return UIImpactFeedbackGenerator(style: .light)
          }
      }
}

And implement a global func API using:

@available(iOS 10.0, *)
   public func withHapticVibration(_ intesity: Vibration) {
       intesity.hapticFeedback().impactOccurred()
}

Sounds

The already implemented SwiftySound file will allow for quick sounds to be played.

For Example, using: Sound.play(file: "dog.wav") or Sound.play(url: fileURL)

@rldaulton rldaulton added the enhancement New feature or request label Apr 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant