Skip to content

Commit

Permalink
Fixed present window getter.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed Jun 3, 2021
1 parent e6c8a66 commit 0dcee61
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion SPAlert.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'SPAlert'
s.version = '3.0.8'
s.version = '3.0.9'
s.summary = 'Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets.'
s.homepage = 'https://github.com/ivanvorobei/SPAlert'
s.source = { :git => 'https://github.com/ivanvorobei/SPAlert.git', :tag => s.version }
Expand Down
8 changes: 7 additions & 1 deletion Sources/SPAlert/SPAlertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ open class SPAlertView: UIView {
return view
}()

weak open var presentWindow: UIWindow? = UIApplication.shared.windows.first
weak open var presentWindow: UIWindow?

// MARK: - Init

Expand Down Expand Up @@ -157,7 +157,13 @@ open class SPAlertView: UIView {
}

open func present(duration: TimeInterval = 1.5, haptic: SPAlertHaptic = .success, completion: (() -> Void)? = nil) {

if self.presentWindow == nil {
self.presentWindow = UIApplication.shared.windows.first
}

guard let window = self.presentWindow else { return }

window.addSubview(self)

// Prepare for present
Expand Down

0 comments on commit 0dcee61

Please sign in to comment.