Skip to content

Instantly share code, notes, and snippets.

@hsleedevelop
Created April 23, 2020 01:23
Show Gist options
  • Save hsleedevelop/5af5e96c00a5445b6118953d182dd4a0 to your computer and use it in GitHub Desktop.
Save hsleedevelop/5af5e96c00a5445b6118953d182dd4a0 to your computer and use it in GitHub Desktop.
ViewController Extension
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