Created
September 12, 2016 12:09
-
-
Save YuiChiLo/0455d53d4c303f887fc583002be441e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIViewController { | |
func getForegroundAlertController() -> UIAlertController? { | |
var viewController = UIApplication.sharedApplication().keyWindow?.rootViewController | |
while let controller = viewController?.presentedViewController { | |
if controller is UIAlertController { | |
viewController = controller | |
break | |
} | |
} | |
guard let alert = viewController as? UIAlertController else { | |
return nil | |
} | |
return alert | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment