Skip to content

Commit

Permalink
Temporary fix for iOS 13 SplitVC not rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
pacient committed Jul 18, 2019
1 parent f14b804 commit 0c8517c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Presentation/UIViewController+Presentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ public extension UIViewController {
func present<VC: UIViewController, Value>(_ viewController: VC, style: PresentationStyle = .default, options: PresentationOptions = .defaults, function: @escaping (VC, DisposeBag) -> Future<Value>) -> Future<Value> {
let vc = viewController
let root = rootViewController
guard (root.isViewLoaded && root.view.window != nil) || unitTestDisablePresentWaitForWindow else {

// iOS 13 temporary fix for issue #40: https://github.com/iZettle/Presentation/issues/40
let shouldPresentImmediately: Bool
if #available(iOS 13.0, *) {
shouldPresentImmediately = root is UISplitViewController || vc is UISplitViewController
} else {
shouldPresentImmediately = false
}

guard shouldPresentImmediately || (root.isViewLoaded && root.view.window != nil) || unitTestDisablePresentWaitForWindow else {
// Wait for root to be presented before presenting vc
return root.signal(for: \.view).flatMapLatest { $0.hasWindowSignal.atOnce() }.filter { $0 }.future.flatMap { _ in
self.present(vc, style: style, options: options, function: function)
Expand Down

0 comments on commit 0c8517c

Please sign in to comment.