Skip to content

Commit 593dd19

Browse files
committed
Add warning haptic
1 parent 17192fc commit 593dd19

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Source/SPAlert/Models/SPAlertHaptic.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import UIKit
2424
public enum SPAlertHaptic {
2525

2626
case success
27+
case warning
2728
case error
2829
case none
2930

@@ -33,6 +34,8 @@ public enum SPAlertHaptic {
3334
switch self {
3435
case .success:
3536
generator.notificationOccurred(UINotificationFeedbackGenerator.FeedbackType.success)
37+
case .warning:
38+
generator.notificationOccurred(UINotificationFeedbackGenerator.FeedbackType.warning)
3639
case .error:
3740
generator.notificationOccurred(UINotificationFeedbackGenerator.FeedbackType.error)
3841
case .none:

Source/SPAlert/SPAlert.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import UIKit
2323

2424
public enum SPAlert {
2525

26-
2726
public static func present(title: String, message: String? = nil, preset: SPAlertPreset) {
2827
let alertView = SPAlertView(title: title, message: message, preset: preset)
2928
alertView.present()
@@ -34,8 +33,9 @@ public enum SPAlert {
3433
alertView.present()
3534
}
3635

37-
public static func present(message: String) {
36+
public static func present(message: String, haptic: SPAlertHaptic = .none) {
3837
let alertView = SPAlertView(message: message)
38+
alertView.haptic = haptic
3939
alertView.present()
4040
}
4141
}

0 commit comments

Comments
 (0)