Skip to content

Commit 8702253

Browse files
committed
Added dismiss all alerts method.
1 parent 64dd851 commit 8702253

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

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 = '5.1.4'
4+
s.version = '5.1.5'
55
s.summary = 'Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets. Support SwiftUI.'
66
s.homepage = 'https://github.com/sparrowcode/AlertKit'
77
s.source = { :git => 'https://github.com/sparrowcode/AlertKit.git', :tag => s.version }

Sources/AlertKit/AlertKitAPI.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,14 @@ public enum AlertKitAPI {
2525
#endif
2626
}
2727
}
28+
29+
public static func dismissAllAlerts() {
30+
for window in UIApplication.shared.windows {
31+
for view in window.subviews {
32+
if let view = view as? AlertViewProtocol {
33+
view.dismiss()
34+
}
35+
}
36+
}
37+
}
2838
}

Sources/AlertKit/Views/AlertViewProtocol.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import UIKit
33
public protocol AlertViewProtocol {
44

55
func present(on view: UIView, completion: @escaping ()->Void)
6+
func dismiss()
67

78
var completion: (() -> Void)? { get set }
89
}

0 commit comments

Comments
 (0)