dekatotoro / SlideMenuControllerSwift

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.
MIT License
3.4k stars 754 forks source link

ViewDidAppear call more than once #230

Open gbitaudeau opened 7 years ago

gbitaudeau commented 7 years ago

Let use this code after application start (replace window.rootViewController) :

let slideMenuController = SlideMenuController(mainViewController: mainViewController, rightMenuViewController: rightMenuViewController)
window.rootViewController = slideMenuController

mainViewController. viewDidAppear is call twice on iOs 10 because SlideMenuController .viewWillLayoutSubviews is called more than once and its implementation is strange : each time it uses setUpViewController which calls addChildViewController.

To my point of view, it's not a good practice to call addChildViewController on the same child several times (this duplicates viewController life cycle events). Is there a good reason for this, or is this a bug ?

gbitaudeau commented 7 years ago

Please find a correction here : https://github.com/dekatotoro/SlideMenuControllerSwift/pull/255