HeroTransitions / Hero

Elegant transition library for iOS & tvOS

Home Page:https://HeroTransitions.github.io/Hero/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UIViewController deallocated when using function replaceViewController(with:completion)

rafalwojcik opened this issue · comments

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