pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/Urtaq/SSDrawerViewController

thubassets.com/assets/primer-70be7debc79a8eff.css" /> GitHub - Urtaq/SSDrawerViewController: MSDynamicDrawerViewController is written in Objective-C. So, I convert it and write in Swift. · GitHub
Skip to content

Urtaq/SSDrawerViewController

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SSDrawerViewController

Swift

What is this for?

MSDynamicDrawerViewController is written in Objective-C. So, I convert it and write in Swift.
This is integrated with UIKit Dynamics APIs(new in iOS7).
For a detail, you can refer the MSDynamicDrawerViewController.

Requirements

  • iOS 8.1+
  • Swift 3.0+

Installation

Manual Import

Just drag these sources into your project.
I'll support Cocoapods or Carthage ASAP.

Usage

The usage of SSDrawerViewController is same with MSDynamicDrawerViewController.
But, compared to MSDynamicDrawerViewController, SSDrawerViewController is written in Swift.
As a result, the usage is slightly different depends on each language's syntax.

So, I'd like to share my use case in Swift 3.

// AppDelegate.swift

class AppDelegate: UIResponder, UIApplicationDelegate, SSDrawerViewControllerDelegate {
    ...
    var window: UIWindow?
    var drawerController: SSDrawerViewController?
    var isDrawable: Bool = true
    ...

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    ...
        // DrawerViewController
        self.drawerController = self.window!.rootViewController as? SSDrawerViewController
        self.drawerController?.delegate = self
        self.drawerController?.addStylerFromArray([SSDrawerScaleStyler.styler(), SSDrawerFadeStyler.styler(), SSDrawerShadowStyler.styler()], forDirection: SSDrawerDirection.Left)

        let menuViewController: SSMenuViewController = (self.window?.rootViewController?.storyboard?.instantiateViewController(withIdentifier: "MenuViewController") as? SSMenuViewController)!
        menuViewController.drawerViewController = self.drawerController
        self.drawerController?.setDrawerViewController(menuViewController, forDirection: SSDrawerDirection.Left)

        // Transition to the first view controller
        menuViewController.transitionToViewController()

        self.window?.rootViewController = self.drawerController
        self.window?.makeKeyAndVisible()
    ...
    }
    
    ...
    
// MARK: - SSDrawerViewControllerDelegate

    func drawerViewController(_ drawerViewController: SSDrawerViewController, mayUpdateToPaneState paneState: SSDrawerMainState, forDirection direction: SSDrawerDirection) {
        print("Drawer view controller may update to state `\(paneState)` for direction `\(direction)`")

        if paneState == .open {
            if let menuViewController = drawerViewController.drawerViewController as? SSMenuViewController {
                if let headerView = menuViewController.menuTableView.headerView(forSection: 0) as? SSMenuHeadView {
                    headerView.configView()
                }
            }
        }
    }

    func drawerViewController(_ drawerViewController: SSDrawerViewController, didUpdateToPaneState paneState: SSDrawerMainState, forDirection direction: SSDrawerDirection) {
        print("Drawer view controller did update to state `\(paneState)` for direction `\(direction)`")
    }

    func drawerViewController(_ drawerViewController: SSDrawerViewController, shouldBeginPanePan panGestureRecognizer: UIPanGestureRecognizer) -> Bool {
        return self.isDrawable
    }
}
// SSMenuViewController.swift

class SSMenuViewController: UIViewController {
    ...
    weak var drawerViewController: SSDrawerViewController?
    ...
    func transitionToViewController() -> Void {
        let animateTransition: Bool = self.drawerViewController?.mainViewController != nil

        let mainNavigationController: UINavigationController = (UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MasterNavigationController") as? UINavigationController)!

        self.drawerViewController?.setMainViewController(mainNavigationController, animated: animateTransition, completion: nil)
    }
}

License

SSDrawerViewController is available under the MIT license. See the LICENSE file for more info.

About

MSDynamicDrawerViewController is written in Objective-C. So, I convert it and write in Swift.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy