Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delayed presentation of UISplitViewController's content breaks on iPhone with the iOS 13 beta sdk #40

Open
nataliq opened this issue Jun 9, 2019 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@nataliq
Copy link
Contributor

nataliq commented Jun 9, 2019

Expected Behavior

Running the Messages example app on iPhone running iOS 13 should show the list of messages.

Current Behavior

An empty grey screen is shown.

Steps to Reproduce

  1. Build and run the Messages example app with Xcode 11 on an iPhone simulator.

Context

  • Operating Version: iOS 13 beta 1
  • Swift version: 5.1

In the main present method of UIViewController we delay the presentation if the view controller is not loaded yet. It seems like setting the viewControllers of a UISplitViewController or a UINavigationController after it was presented in automatic mode on iPhone (showing only one of the screens), doesn't add the view controllers to the screen even though they are assigned to the property. This can be reproduced by replacing this line of code of the example app:

bag += split.present(viewController, options: [ .defaults, .showInMaster ])

with

let nc = customNavigationController([ .defaults, .showInMaster ])
nc.viewControllers = [viewController]

DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2)) {
    split.viewControllers = [nc]
}

Removing the asyncAfter call results in a correct behaviour.

Failure Logs

No logs.

@nataliq
Copy link
Contributor Author

nataliq commented Jun 9, 2019

Dirty fix for the time being:

Add self is UISplitViewController || to the guard statement in UIViewController+Presentation.

@nataliq nataliq added the bug Something isn't working label Jun 10, 2019
@niil-ohlin niil-ohlin self-assigned this Jun 13, 2019
@niil-ohlin
Copy link
Contributor

Just to make sure that I understood it correctly.

// 1
bag += split.present(viewController, options: [ .defaults, .showInMaster ])

and

// 2
let nc = customNavigationController([ .defaults, .showInMaster ])
nc.viewControllers = [viewController]

DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2)) {
    split.viewControllers = [nc]
}

does not work as expected. But

// 3
let nc = customNavigationController([ .defaults, .showInMaster ])
nc.viewControllers = [viewController]

split.viewControllers = [nc]

has the correct expected behavior?

@nataliq
Copy link
Contributor Author

nataliq commented Jun 13, 2019

Yes, exactly. See this: https://gist.github.com/nataliq/deef2efbd9ddab5e2b3bbf53dff9c0c0
I wanna file a radar but every time I go to the new feedback assistant, it's not working.

@nataliq
Copy link
Contributor Author

nataliq commented Jul 17, 2019

I reported the issue through feedback assistant. Doesn't seem to be addressed in the latest betas too.

@nataliq
Copy link
Contributor Author

nataliq commented Jul 26, 2019

Temporary fix implemented in 1.7.0 (#43)

@CJEkman
Copy link
Contributor

CJEkman commented Jan 12, 2021

Since it was discovered that this also affects UINavigationController, the dirty fix has been expanded to:

shouldPresentImmediately = root is UISplitViewController || vc is UISplitViewController || (root as? UINavigationController)?.viewControllers.isEmpty == true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants