Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.99 KB

README.md

File metadata and controls

52 lines (37 loc) · 1.99 KB

TapticEffects

Easily generate vibrations, built in Taptic Engine & Haptic Feedback at your iOS apps.

Swift Platform License

Overview

TapticEffects generates feedback vibrations using Taptic or Haptic Engine on iOS device. I don't post any example project, becasue there is no need for this. Class is simple and easy in use. It is just wrapper of UINotificationFeedbackGenerator, UISelectionFeedbackGenerator, UIImpactFeedbackGenerator.

Usage

TapticEffects class doesn't require any initialization at your project. You can call its methods from any place using type methods of class.

/// Performs haptic feedback - impact.
TapticEffectsService.performFeedbackImpact(style: .medium)

/// Performs haptic feedback - selection.
TapticEffectsService.performFeedbackSelection()

/// Performs taptic feedback based on 'TapticEngineFeedbackIdentifier'.
TapticEffectsService.performTapticFeedback(from: TapticEffectsService.TapticEngineFeedbackIdentifier.peek)

/// Available Identifiers

/// 'Peek' feedback (weak boom)
case peek = 1519
/// 'Pop' feedback (strong boom)
case pop = 1520
/// 'Cancelled' feedback (three sequential weak booms)
case cancelled = 1521
/// 'Try Again' feedback (week boom then strong boom)
case tryAgain = 1102
/// 'Failed' feedback (three sequential strong booms)
case failed = 1107

Requirements

  • Swift 3.0+
  • iOS 10.0+
  • iPhone 6s or higher

Installation

Manually

Just download and drop TapticEffectsService.swift class into your project.

License

TapticEffects is available under the MIT license. See the LICENSE file for more info.