Skip to content

Commit

Permalink
Merge pull request #22 from pherret/master
Browse files Browse the repository at this point in the history
Fix opening SFSafariViewController from presented modals
  • Loading branch information
edjiang authored Sep 30, 2016
2 parents a85b51b + c8ef24c commit d81eb2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Simplicity/Simplicity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public final class Simplicity {
private static func presentSafariView(_ url: URL) {
if #available(iOS 9, *) {
safari = SFSafariViewController(url: url)
UIApplication.shared.delegate?.window??.rootViewController?.present(safari!, animated: true, completion: nil)
var topController = UIApplication.shared.keyWindow?.rootViewController
while let vc = topController?.presentedViewController {
topController = vc
}
topController?.present(safari!, animated: true, completion: nil)
} else {
UIApplication.shared.openURL(url)
}
Expand Down

0 comments on commit d81eb2e

Please sign in to comment.