Open jpcguy89 opened 8 years ago
@jpcguy89 Agreed! What I did to implement is the following.
Step 1: I included the library in my PodFile and updated
Step 2: I created 2 view controllers in my Main.storyboard
(or whatever you called it). I gave the main view and left side view names (Main
, LeftMenu
) respectively. These will be called in Step 3.
Step 3: I altered my AppDelegate didFinishLaunchingWithOptions
with the following:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Get reference to our main storyboard
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
// Grab the main view controller, you'll see the name "Main" below.. Change this as needed
if let mainViewController:UIViewController = mainStoryboard.instantiateViewControllerWithIdentifier("Main") {
// Get reference to the LeftMenu view
let leftMenuViewController:UIViewController = mainStoryboard.instantiateViewControllerWithIdentifier("LeftMenu")
// Set up a new SlideMenuController instance and pass in the view controllers
let slideMenuController = SlideMenuController(mainViewController: mainViewController,
leftMenuViewController: leftMenuViewController)
// Make the slideMenuController the root view, IE: First view (since the Main/Left are children of it)
self.window?.rootViewController = slideMenuController
// Display the view
self.window?.makeKeyAndVisible()
}
return true
}
Hope this helps and maybe it will help the author create a nice little tutorial. You can also invoke the 2 view controllers in code (no storyboard needed). This is just ONE way to utilize this (and many other) libraries.
hey @jpcguy89 , check ExampleSlideMenuControllerSwift ... thanks
@mkeefe I do not want to add it in AppDelegate, but after that controller I want to add sliding menu. Any possible way?
Hi,
I'm trying to utilize this in my application, but I'm finding it difficult to integrate. After reading the setup instructions, there appears to be a lot missing. Like where the variables used in the App Delegate's "didFinishLaunching" code came from.
I would also request that you include a demo project in the repo, so that if someone gets confused, they can refer to it if they get stuck.