EatCodePlaySleep
EatCodePlaySleep

Reputation: 95

Swift 3 Implementing SideMenu control without Storyboard(hardcoded)

I'm trying to implement this control: Side Menu It say's that i need to instatiate it in the storyboard:

let menuLeftNavigation = Controllerstoryboard!.instantiateViewController(withIdentifier: "LeftMenuNavigationController") as! UISideMenuNavigationController

But I don't have a storyboard and I already created a UINavigationController (see below) So that I can use the module:

SideMenuManager.menuLeftNavigationController = menuLeftNavigationController

AppDelegate.swift

didFinishLaunchingWithOptions {
        let layout = UICollectionViewFlowLayout()
        let featuredVideosController = FeaturedVideosController(collectionViewLayout: layout)
        window?.rootViewController = UINavigationController(rootViewController:featuredVideosController) //Required

    }

I'm currently stucked here. Thanks for the help :)

Upvotes: 1

Views: 491

Answers (1)

Yun CHEN
Yun CHEN

Reputation: 6648

In FeaturedVideosController's viewDidLoad method, add:

let menuLeftNavigationController = UISideMenuNavigationController(rootViewController: YourMenuContentViewController)
menuLeftNavigationController.leftSide = true
SideMenuManager.menuLeftNavigationController = menuLeftNavigationController

Check more detail in Side Menu's Code Implementation section.

Upvotes: 2

Related Questions