Created
April 23, 2020 01:23
-
-
Save hsleedevelop/5af5e96c00a5445b6118953d182dd4a0 to your computer and use it in GitHub Desktop.
ViewController Extension
This file contains hidden or 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
extension UIViewController { | |
func isVisible() -> Bool { | |
if #available(iOS 9.0, *) { | |
if let view = self.viewIfLoaded { | |
return view.window != nil | |
} | |
return false | |
} else { | |
return self.isViewLoaded && self.view.window != nil | |
} | |
} | |
} | |
extension UIViewController { | |
/// iOS13의 모달 프레젠테이션 대응을 위한 present overload | |
@objc | |
func presentInFullScreen(_ viewController: UIViewController, | |
animated: Bool, | |
completion: (() -> Void)? = nil) { | |
viewController.modalPresentationStyle = .fullScreen | |
present(viewController, animated: animated, completion: completion) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment