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 755 forks source link

No Demo Project in Repo, Hard to Understand (Possibly Incomplete) Instructions #208

Open jpcguy89 opened 8 years ago

jpcguy89 commented 8 years ago

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.

mkeefe commented 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.

zahedul commented 8 years ago

hey @jpcguy89 , check ExampleSlideMenuControllerSwift ... thanks

Neeraj204 commented 7 years ago

@mkeefe I do not want to add it in AppDelegate, but after that controller I want to add sliding menu. Any possible way?