Last active
June 20, 2016 16:14
-
-
Save vinnyoodles/3f5666da3cc64d42538f7efd44a47309 to your computer and use it in GitHub Desktop.
DualSlideMenuViewController: refresh on action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
let defaults = NSUserDefaults.standardUserDefaults(); | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
storyboard = UIStoryboard(name: "Main", bundle: nil) | |
let leftView = storyboard?.instantiateViewControllerWithIdentifier("LeftMenuController") | |
let rightView = storyboard?.instantiateViewControllerWithIdentifier("RightMenuController") | |
let mainView = storyboard?.instantiateViewControllerWithIdentifier("MainController") as! MainViewController | |
let controller = DualSlideMenuViewController(mainViewController: mainView!, leftMenuViewController: leftView!, rightMenuViewController: rightView!) | |
controller.delegate = mainView // Assign delegate variable inside DualSlideMenuViewController as MainViewController | |
mainView.controller = controller // Assign dualslidemenu controller in MainView as the controller instance | |
window!.rootViewController = controller | |
window!.makeKeyAndVisible() | |
return true | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DualSlideMenu | |
class MainViewController: UIViewController, DualSlideMenuViewControllerDelegate { | |
/* Initialization Methods */ | |
var controller: DualSlideMenuViewController! | |
func onSwipe() { | |
if controller.currentState == .Main { | |
// Action that will be performed whenever the main screen has appeared after swiping | |
// ex. tableView.reloadData() | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment