dekatotoro / dekatotoro/SlideMenuControllerSwift

Root View Controller gets changing after navigating from Main ViewController to another controller by push in swift

Open
#385 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
3.4k
Forks
742
PR merge metrics
No merged PRs in 30d

Description

I have signup view in my application. After signup completes, I have Mainview Controller and I am making that as RootViewController with Slidemenucontroller.

Its working fine, but, after I am navigating from MainViewController to some other viewcontroller by doing push, once I pressed on Slidemenucontroller home button, its showing last pushed viewconroller instead of mainviewcontroller.

Even I set slidemenuviewcontroller with rootviewcontroller as Mainviewcontroller.

And I am using SlideMenuControllerSwift library to show slidemenu in my application.

```
Here is my code

// create viewController code...
let storyboard = UIStoryboard(name: "Main", bundle: nil)

let mainViewController = storyboard.instantiateViewController(withIdentifier: "MainViewController") as! MainViewController
let leftViewController = storyboard.instantiateViewController(withIdentifier: "LeftViewController") as! LeftViewController

let nvc: UINavigationController = UINavigationController(rootViewController: mainViewController)

let navigationBarAppearace = UINavigationBar.appearance()
navigationBarAppearace.tintColor = UIColor.white
navigationBarAppearace.titleTextAttributes = [NSAttributedStringKey.foregroundColor:UIColor.white]

leftViewController.mainViewController = nvc

let appDelegate = UIApplication.shared.delegate as! AppDelegate

let slideMenuController = SlideMenuController(mainViewController:nvc, leftMenuViewController: leftViewController)
appDelegate.window?.rootViewController = slideMenuController
// slideMenuController.delegate = self as! SlideMenuControllerDelegate
appDelegate.window?.makeKeyAndVisible()

```

How to fix this?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the SlideMenuController(mainViewController:leftMenuViewController:) setup and the UINavigationController rooted at MainViewController. Reproduce the push from MainViewController, then select the slide-menu Home action and compare which controller is displayed with the intended MainViewController. Done means Home returns to MainViewController rather than the last pushed controller.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.