Skip to content

Commit f1845da

Browse files
committed
#88 - choose the presented controller if available as source vc
1 parent de436e1 commit f1845da

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/UIImageView_Extensions.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ extension UIImageView {
1010
}
1111

1212
private var vc:UIViewController? {
13-
return UIApplication.shared.keyWindow?.rootViewController
13+
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController
14+
else { return nil }
15+
return rootVC.presentedViewController != nil ? rootVC.presentedViewController : rootVC
1416
}
1517

1618
public func setupImageViewer(

0 commit comments

Comments
 (0)