mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-06-26 17:10:36 +00:00
31 lines
799 B
Swift
31 lines
799 B
Swift
|
import UIKit
|
||
|
|
||
|
public class HapticManager {
|
||
|
public static let shared: HapticManager = .init()
|
||
|
|
||
|
private let selectionGenerator = UISelectionFeedbackGenerator()
|
||
|
private let impactGenerator = UIImpactFeedbackGenerator(style: .heavy)
|
||
|
private let notificationGenerator = UINotificationFeedbackGenerator()
|
||
|
|
||
|
private init() {
|
||
|
selectionGenerator.prepare()
|
||
|
impactGenerator.prepare()
|
||
|
}
|
||
|
|
||
|
public func selectionChanged(){
|
||
|
selectionGenerator.selectionChanged()
|
||
|
}
|
||
|
|
||
|
public func impact() {
|
||
|
impactGenerator.impactOccurred()
|
||
|
}
|
||
|
|
||
|
public func impact(intensity: CGFloat) {
|
||
|
impactGenerator.impactOccurred(intensity: intensity)
|
||
|
}
|
||
|
|
||
|
public func notification(type: UINotificationFeedbackGenerator.FeedbackType){
|
||
|
notificationGenerator.notificationOccurred(type)
|
||
|
}
|
||
|
}
|