This is a Swift implementation of a swipeable reveal view for iOS. Currently the capabilities are limited, but planned to be expanded into a more robust and modular based setup.
At a minimum you need to include the following files in your project:
- RearNavigationViewController.swift
- RearNavControllerDelegate.swift
Currently, you'll need to make a seperate function for each of the navigation
items you plan on having in the RearNavigationViewController.swift file. Plans
are to abstract this out to not require this, but at this time, that implementation
hasn't been completed.
Example:
func loadSettingsView(sender: UIButton){ let settingsViewCtrl: ViewController = ViewController() settingsViewCtrl.rearNavDelegate = selfself.loadFrontViewWithController(settingsViewCtrl)
}
AppDelegate.swift
Modifications to the AppDelegate.swift file are also necessary for the reveal
view to work correctly.
Add the following to your AppDelegate.swift file in your project, setting the let viewController with the instantiation of the view controller you want to be viewed first:
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)let viewController = ViewController() let navWidth: CGFloat = 220
let rearNavigationViewController = RearNavigationViewController(frontViewCtrl: viewController, navWidth: navWidth);
self.window!.rootViewController = rearNavigationViewController;
self.window!.makeKeyAndVisible() return true