@@ -13,7 +13,7 @@ import UIKit
1313class CFAlertViewController : UIViewController {
1414
1515 // MARK: - Declarations
16- public typealias CFAlertViewControllerDismissBlock = ( ) -> ( )
16+ public typealias CFAlertViewControllerDismissBlock = ( _ isBackgroundTapped : Bool ) -> ( )
1717
1818 @objc public enum CFAlertControllerStyle : Int {
1919 case alert = 0
@@ -213,6 +213,10 @@ class CFAlertViewController: UIViewController {
213213 }
214214
215215 public func dismissAlert( withAnimation animate: Bool , completion: ( ( _: Void ) -> Void ) ? ) {
216+ dismissAlert ( withAnimation: animate, isBackgroundTapped: false , completion: completion)
217+ }
218+
219+ private func dismissAlert( withAnimation animate: Bool , isBackgroundTapped: Bool , completion: ( ( _: Void ) -> Void ) ? ) {
216220
217221 // Dismiss Self
218222 self . dismiss ( animated: animate, completion: { ( ) -> Void in
@@ -222,7 +226,7 @@ class CFAlertViewController: UIViewController {
222226 }
223227 // Call Dismiss Block
224228 if let dismissHandler = self . dismissHandler {
225- dismissHandler ( )
229+ dismissHandler ( isBackgroundTapped )
226230 }
227231 } )
228232 }
@@ -310,9 +314,9 @@ class CFAlertViewController: UIViewController {
310314 // Close Keyboard
311315 self . view. endEditing ( true )
312316 }
313- else if self . shouldDismissOnBackgroundTap {
317+ else if shouldDismissOnBackgroundTap {
314318 // Dismiss Alert
315- self . dismissAlert ( withAnimation: true , completion: { ( ) -> Void in
319+ dismissAlert ( withAnimation: true , isBackgroundTapped : true , completion: { ( ) -> Void in
316320 // Simulate Cancel Button
317321 for existingAction : CFAlertAction in self . actionList {
318322 if existingAction. style == . Cancel {
0 commit comments