@@ -28,19 +28,33 @@ import UIKit
28
28
public enum SPAlert {
29
29
30
30
/**
31
- Present alert with preset and haptic.
31
+ Present alert with preset and custom haptic.
32
32
33
33
- parameter title: Title text in alert.
34
34
- parameter message: Subtitle text in alert. Optional.
35
35
- parameter preset: Icon ready-use style or custom image.
36
36
- parameter haptic: Haptic response with present. Default is `.success`.
37
37
- parameter completion: Will call with dismiss alert.
38
38
*/
39
- public static func present( title: String , message: String ? = nil , preset: SPAlertIconPreset , haptic: SPAlertHaptic = . success , completion: ( ( ) -> Void ) ? = nil ) {
39
+ public static func present( title: String , message: String ? = nil , preset: SPAlertIconPreset , haptic: SPAlertHaptic , completion: ( ( ) -> Void ) ? = nil ) {
40
40
let alertView = SPAlertView ( title: title, message: message, preset: preset)
41
41
alertView. present ( haptic: haptic, completion: completion)
42
42
}
43
43
44
+ /**
45
+ Present alert with preset and automatically detect type haptic.
46
+
47
+ - parameter title: Title text in alert.
48
+ - parameter message: Subtitle text in alert. Optional.
49
+ - parameter preset: Icon ready-use style or custom image.
50
+ - parameter completion: Will call with dismiss alert.
51
+ */
52
+ public static func present( title: String , message: String ? = nil , preset: SPAlertIconPreset , completion: ( ( ) -> Void ) ? = nil ) {
53
+ let alertView = SPAlertView ( title: title, message: message, preset: preset)
54
+ let haptic = preset. getHaptic ( )
55
+ alertView. present ( haptic: haptic, completion: completion)
56
+ }
57
+
44
58
/**
45
59
Show only message, without title and icon.
46
60
0 commit comments