diff --git a/Example App/SPAlert.xcodeproj/project.pbxproj b/Example App/SPAlert.xcodeproj/project.pbxproj index 8051f16..1e62417 100644 --- a/Example App/SPAlert.xcodeproj/project.pbxproj +++ b/Example App/SPAlert.xcodeproj/project.pbxproj @@ -18,7 +18,6 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - F43A587826564DDF009098ED /* SPAlert */ = {isa = PBXFileReference; lastKnownFileType = folder; name = SPAlert; path = ..; sourceTree = ""; }; F47E1DFA26564B6A008D901C /* iOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; F47E1E0B26564B6C008D901C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; F47E1E1226564BB3008D901C /* AlertPresetModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertPresetModel.swift; sourceTree = ""; }; @@ -26,6 +25,7 @@ F47E1E1626564BB3008D901C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; F47E1E1726564BB3008D901C /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; F47E1E1926564BB3008D901C /* PresetsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresetsController.swift; sourceTree = ""; }; + F482FBF42756A77100E40FDA /* SPAlert */ = {isa = PBXFileReference; lastKnownFileType = folder; name = SPAlert; path = ..; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -45,7 +45,7 @@ F47E1DF126564B6A008D901C = { isa = PBXGroup; children = ( - F43A587826564DDF009098ED /* SPAlert */, + F482FBF42756A77100E40FDA /* SPAlert */, F47E1DFC26564B6A008D901C /* iOS Example */, F47E1DFB26564B6A008D901C /* Products */, ); diff --git a/Example App/SPAlert.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate b/Example App/SPAlert.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate index d0ce259..147d619 100644 Binary files a/Example App/SPAlert.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate and b/Example App/SPAlert.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SPAlert.podspec b/SPAlert.podspec index 96b01dd..16990fe 100644 --- a/SPAlert.podspec +++ b/SPAlert.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'SPAlert' - s.version = '3.5.0' + s.version = '3.5.1' 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 } diff --git a/Sources/SPAlert/SPAlertView.swift b/Sources/SPAlert/SPAlertView.swift index 9178673..9823911 100644 --- a/Sources/SPAlert/SPAlertView.swift +++ b/Sources/SPAlert/SPAlertView.swift @@ -88,14 +88,6 @@ open class SPAlertView: UIView { public init(title: String, message: String? = nil, preset: SPAlertIconPreset) { super.init(frame: CGRect.zero) - - switch preset { - case .spinner: - self.dismissInTime = false - default: - self.dismissInTime = true - } - commonInit() layout = SPAlertLayout(for: preset) setTitle(title) @@ -103,6 +95,15 @@ open class SPAlertView: UIView { setMessage(message) } setIcon(for: preset) + + switch preset { + case .spinner: + dismissInTime = false + dismissByTap = false + default: + dismissInTime = true + dismissByTap = true + } } public init(message: String) { @@ -110,11 +111,15 @@ open class SPAlertView: UIView { commonInit() layout = SPAlertLayout.message() setMessage(message) + dismissInTime = true + dismissByTap = true } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) commonInit() + dismissInTime = true + dismissByTap = true } private func commonInit() { @@ -127,11 +132,6 @@ open class SPAlertView: UIView { backgroundColor = .clear addSubview(backgroundView) - if dismissByTap { - let tapGesterRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismiss)) - addGestureRecognizer(tapGesterRecognizer) - } - setCornerRadius(self.cornerRadius) } @@ -217,6 +217,11 @@ open class SPAlertView: UIView { setFrame() transform = transform.scaledBy(x: self.presentDismissScale, y: self.presentDismissScale) + if dismissByTap { + let tapGesterRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismiss)) + addGestureRecognizer(tapGesterRecognizer) + } + // Present haptic.impact()