SideMenu icon indicating copy to clipboard operation
SideMenu copied to clipboard

'Caching the Content' is not working

Open parthsit opened this issue 5 years ago • 1 comments

When I set any view controller as a content view controller for the first time then after the second time I don't want to load it again from the start. I just need to show the screen again without any changes.

Here what I have done in my project:

  1. Setup side menu programmatically
let sideMenucontroller = NavigationManager.shared.sideMenuController
let controller = NavigationManager.shared.dashboardNavController
sideMenucontroller.contentViewController = controller
appdelegate.window?.rootViewController = sideMenucontroller
  1. Cached all required controllers in 'dashboardNavController' which I have set up earlier
sideMenuController?.cache(viewController: NavigationManager.shared.dashboardNavController, with: "dashboardNavController")
sideMenuController?.cache(viewController: NavigationManager.shared.dashboardViewController, with: "dashboardViewController")
  1. Opened dashboard controller from the another view controller as mentioned in the document sideMenuController?.setContentViewController(with: "dashboardNavController") -> By doing this dashboardViewController is appearing from start.

For example, what I need is:
Normally when view controller loads then it calls first viewDidload() and when view controller appears again then it will not load viewDidLoad() instead of it will start from viewWillAppear(), this behavior I need here.

Thanks in advance.

parthsit avatar May 18 '20 16:05 parthsit

@parthsit Can you check whether lazyCachedViewControllerGenerators store the right view controller?

kukushi avatar May 25 '20 16:05 kukushi