@@ -8,25 +8,25 @@ import UIKit
88import SideMenu
99
1010class ViewController : UIViewController {
11- private var selectedIndex = 0
12- private var transitionPoint : CGPoint !
13- private var contentType : ContentType = . Music
14- private var navigator : UINavigationController !
15- lazy private var menuAnimator : MenuTransitionAnimator ! = MenuTransitionAnimator ( mode: . Presentation , shouldPassEventsOutsideMenu: false ) { [ unowned self] in
16- self . dismissViewControllerAnimated ( true , completion: nil )
11+ fileprivate var selectedIndex = 0
12+ fileprivate var transitionPoint : CGPoint !
13+ fileprivate var contentType : ContentType = . Music
14+ fileprivate var navigator : UINavigationController !
15+ lazy fileprivate var menuAnimator : MenuTransitionAnimator ! = MenuTransitionAnimator ( mode: . presentation , shouldPassEventsOutsideMenu: false ) { [ unowned self] in
16+ self . dismiss ( animated : true , completion: nil )
1717 }
18- override func prepareForSegue ( segue: UIStoryboardSegue , sender: AnyObject ? ) {
19- switch ( segue. identifier, segue. destinationViewController ) {
20- case ( . Some ( " presentMenu " ) , let menu as MenuViewController ) :
18+ override func prepare ( for segue: UIStoryboardSegue , sender: Any ? ) {
19+ switch ( segue. identifier, segue. destination ) {
20+ case ( . some ( " presentMenu " ) , let menu as MenuViewController ) :
2121 menu. selectedItem = selectedIndex
2222 menu. delegate = self
2323 menu. transitioningDelegate = self
24- menu. modalPresentationStyle = . Custom
25- case ( . Some ( " embedNavigator " ) , let navigator as UINavigationController ) :
24+ menu. modalPresentationStyle = . custom
25+ case ( . some ( " embedNavigator " ) , let navigator as UINavigationController ) :
2626 self . navigator = navigator
2727 self . navigator. delegate = self
2828 default :
29- super. prepareForSegue ( segue, sender: sender)
29+ super. prepare ( for : segue, sender: sender)
3030 }
3131 }
3232}
@@ -37,23 +37,23 @@ extension ViewController: MenuViewControllerDelegate {
3737 transitionPoint = point
3838 selectedIndex = index
3939
40- let content = storyboard!. instantiateViewControllerWithIdentifier ( " Content " ) as! ContentViewController
40+ let content = storyboard!. instantiateViewController ( withIdentifier : " Content " ) as! ContentViewController
4141 content. type = contentType
4242 self . navigator. setViewControllers ( [ content] , animated: true )
4343
44- dispatch_async ( dispatch_get_main_queue ( ) ) {
45- self . dismissViewControllerAnimated ( true , completion: nil )
44+ DispatchQueue . main . async {
45+ self . dismiss ( animated : true , completion: nil )
4646 }
4747 }
4848
4949 func menuDidCancel( _: MenuViewController ) {
50- dismissViewControllerAnimated ( true , completion: nil )
50+ dismiss ( animated : true , completion: nil )
5151 }
5252}
5353
5454extension ViewController : UINavigationControllerDelegate {
55- func navigationController( _: UINavigationController , animationControllerForOperation _: UINavigationControllerOperation ,
56- fromViewController _: UIViewController , toViewController _: UIViewController ) -> UIViewControllerAnimatedTransitioning ? {
55+ func navigationController( _: UINavigationController , animationControllerFor _: UINavigationControllerOperation ,
56+ from _: UIViewController , to _: UIViewController ) -> UIViewControllerAnimatedTransitioning ? {
5757
5858 if let transitionPoint = transitionPoint {
5959 return CircularRevealTransitionAnimator ( center: transitionPoint)
@@ -63,13 +63,13 @@ extension ViewController: UINavigationControllerDelegate {
6363}
6464
6565extension ViewController : UIViewControllerTransitioningDelegate {
66- func animationControllerForPresentedController ( presented: UIViewController , presentingController _: UIViewController ,
67- sourceController _: UIViewController ) -> UIViewControllerAnimatedTransitioning ? {
66+ func animationController ( forPresented presented: UIViewController , presenting _: UIViewController ,
67+ source _: UIViewController ) -> UIViewControllerAnimatedTransitioning ? {
6868 return menuAnimator
6969 }
7070
71- func animationControllerForDismissedController ( dismissed: UIViewController ) -> UIViewControllerAnimatedTransitioning ? {
72- return MenuTransitionAnimator ( mode: . Dismissal )
71+ func animationController ( forDismissed dismissed: UIViewController ) -> UIViewControllerAnimatedTransitioning ? {
72+ return MenuTransitionAnimator ( mode: . dismissal )
7373 }
7474
7575}
0 commit comments