Skip to content

Instantly share code, notes, and snippets.

@vinnyoodles
Last active June 20, 2016 16:14
Show Gist options
  • Save vinnyoodles/3f5666da3cc64d42538f7efd44a47309 to your computer and use it in GitHub Desktop.
Save vinnyoodles/3f5666da3cc64d42538f7efd44a47309 to your computer and use it in GitHub Desktop.
DualSlideMenuViewController: refresh on action
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
}
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