Skip to content

Commit 1c1341e

Browse files
committed
Added more for spinner preset.
1 parent 06d3152 commit 1c1341e

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Once you have your Swift package set up, adding as a dependency is as easy as ad
3939

4040
```swift
4141
dependencies: [
42-
.package(url: "https://github.com/ivanvorobei/SPAlert", .upToNextMajor(from: "4.0.1"))
42+
.package(url: "https://github.com/ivanvorobei/SPAlert", .upToNextMajor(from: "4.1.0"))
4343
]
4444
```
4545

SPAlert.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'SPAlert'
4-
s.version = '4.0.1'
4+
s.version = '4.1.0'
55
s.summary = 'Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets. Support SwiftUI.'
66
s.homepage = 'https://github.com/ivanvorobei/SPAlert'
77
s.source = { :git => 'https://github.com/ivanvorobei/SPAlert.git', :tag => s.version }

Sources/SPAlert/SPAlert.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ public enum SPAlert {
6767
alertView.present(haptic: haptic, completion: completion)
6868
}
6969

70+
/**
71+
SPAlert: Show present only.
72+
73+
- parameter completion: Will call with dismiss alert.
74+
*/
75+
public static func present(preset: SPAlertIconPreset, completion: (() -> Void)? = nil) {
76+
let alertView = SPAlertView(preset: preset)
77+
alertView.present(haptic: preset.haptic, completion: completion)
78+
}
79+
7080
/**
7181
SPAlert: Dismiss all `SPAlert` views.
7282
*/

Sources/SPAlert/SPAlertView.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,8 @@ open class SPAlertView: UIView {
8686

8787
// MARK: - Init
8888

89-
public init(title: String, message: String? = nil, preset: SPAlertIconPreset) {
90-
super.init(frame: CGRect.zero)
91-
commonInit()
92-
layout = SPAlertLayout(for: preset)
89+
public convenience init(title: String, message: String? = nil, preset: SPAlertIconPreset) {
90+
self.init(preset: preset)
9391
setTitle(title)
9492
if let message = message {
9593
setMessage(message)
@@ -106,6 +104,12 @@ open class SPAlertView: UIView {
106104
}
107105
}
108106

107+
public init(preset: SPAlertIconPreset) {
108+
super.init(frame: CGRect.zero)
109+
commonInit()
110+
layout = SPAlertLayout(for: preset)
111+
}
112+
109113
public init(message: String) {
110114
super.init(frame: CGRect.zero)
111115
commonInit()

0 commit comments

Comments
 (0)