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

UIViewController deallocated when using function replaceViewController(with:completion) #717

Open
rafalwojcik opened this issue Apr 11, 2021 · 0 comments

Comments

@rafalwojcik
Copy link
Contributor

rafalwojcik commented Apr 11, 2021

What did you do?

I'm trying to replace the view controller on the main window of the application, but in commit 800b9d9 you've introduced a regression. by removing ! from #if !TARGET_IS_EXTENSION. Probably it is also causing issues in extensions that do not have UIApplication class. Actually, that code was removed in favor of code from PR #705:

if let parentVC = parentVC {
  base.dismiss(animated: false) {
    parentVC.present(next, animated: false, completion: completion)
  }
} else {
  parentVC?.view.window?.rootViewController = next
}

which doesn't have any sense because in else statement parentVC will be always nil.

What did you expect to happen?

It should just replace the root view controller on that window without deallocating view controller.

What happened instead?

View in the hierarchy is replaced but View Controller is deallocated.

General Information

  • Hero Version: 1.6.0

  • iOS Version(s): All

  • Swift Version: All

  • Devices/Simulators: All

  • Reproducible in Examples? (Yes/No):
    Reproducible in any project when you want to replace root view in any UIWindow

rafalwojcik added a commit to connorgroup/Hero that referenced this issue Apr 11, 2021
…n replacing root view controller of UIWindow
kuyazee pushed a commit that referenced this issue May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant