From 3dfcdfb91db3545cb1d16c564772c8d5bc286955 Mon Sep 17 00:00:00 2001 From: Sai Ram Kotha Date: Thu, 14 Jul 2016 16:02:23 +0530 Subject: [PATCH] fix swift3 beta syntax --- Examples/Simple/.DS_Store | Bin 6148 -> 6148 bytes .../project.pbxproj | 11 +- .../UserInterfaceState.xcuserstate | Bin 0 -> 14582 bytes .../xcschemes/SSASideMenuExample.xcscheme | 101 ++++++ .../xcschemes/xcschememanagement.plist | 27 ++ .../SSASideMenuExample/AppDelegate.swift | 16 +- .../FirstViewController.swift | 6 +- .../LeftMenuViewController.swift | 36 +- .../RightMenuViewController.swift | 38 +- .../SSASideMenuExample/SSASideMenu.swift | 326 +++++++++--------- .../SecondViewController.swift | 8 +- .../SSASideMenuExampleTests.swift | 2 +- 12 files changed, 353 insertions(+), 218 deletions(-) create mode 100644 Examples/Simple/SSASideMenuExample.xcodeproj/project.xcworkspace/xcuserdata/sairam.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 Examples/Simple/SSASideMenuExample.xcodeproj/xcuserdata/sairam.xcuserdatad/xcschemes/SSASideMenuExample.xcscheme create mode 100644 Examples/Simple/SSASideMenuExample.xcodeproj/xcuserdata/sairam.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/Examples/Simple/.DS_Store b/Examples/Simple/.DS_Store index 805117fb2fcfe83d6dd4cd9604a47f6334060183..e6dec5cc65b50235ac7d820d66f0de8f2d7420b0 100644 GIT binary patch delta 60 zcmZoMXffCj#>8~)&g2hFHhj7HE-ophCCLm7m)DBlo&1i;Zt?>rZsxUO2Y_rJ#tEAp QnUAqdY+&2W&heKY0MmjOK>z>% delta 60 zcmZoMXffCj#>CWoVDbkh8@}9p7nhXMl4J&k%aRkHPkzT_H~9e*H#3Co!)UPCk@*>Pjj0kIldpM+rzIGeV{-dj7JK1!y(#GHN8%dB9C81=Lf^v}+-Dnx=K_Rpbtw)>CHgpNP6kUeyM0cUP(LLy1bRW7O{R=&S9z+kJ zhtVVGQS><4k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l5Eji43->=*`dmY9cCINmH`kVH&n?I;${m?IF1I$fIkzWwYi?ieBe@52|7#s)EwYwb zE3I|bS=PDM`PPNjHtP~=ht+32%evG0xb;ozN7k>c-&l`Yzqg*Sp0xgw7oV4qmz<}~ zOUpCnneuY;YyvOqn=6#g+Mc!9=hx5M8JCS!X@01POs7-ED+LCQX zo7FbV=CBpoN^N6o<80-&O4}6MbX%+KEZYj(D%)CH$hOJ0*|ybovF#GuwYEOnZMOUD zsrC%J**?NP+Fov-W^b}Du)FQ8_BQ(xdxw3ceU1HW`#Sr2`$qeD_RaRY?62E@b>umU z9HSkTjvB{wN28<3(dp=N^f*>K);gHuJja!eYaG`*b~tuAZgSk>xZQE5<59;R$6m+& i{DS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Simple/SSASideMenuExample.xcodeproj/xcuserdata/sairam.xcuserdatad/xcschemes/xcschememanagement.plist b/Examples/Simple/SSASideMenuExample.xcodeproj/xcuserdata/sairam.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..42b5f8a --- /dev/null +++ b/Examples/Simple/SSASideMenuExample.xcodeproj/xcuserdata/sairam.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + SSASideMenuExample.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + DC4C1A8B1AA7461E00ACD446 + + primary + + + DC4C1AA01AA7461E00ACD446 + + primary + + + + + diff --git a/Examples/Simple/SSASideMenuExample/AppDelegate.swift b/Examples/Simple/SSASideMenuExample/AppDelegate.swift index ca2a148..9aea2f1 100755 --- a/Examples/Simple/SSASideMenuExample/AppDelegate.swift +++ b/Examples/Simple/SSASideMenuExample/AppDelegate.swift @@ -13,9 +13,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, SSASideMenuDelegate { var window: UIWindow? - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - window = UIWindow(frame: UIScreen.mainScreen().bounds) + window = UIWindow(frame: UIScreen.main().bounds) //MARK : Setup SSASideMenu @@ -23,7 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, SSASideMenuDelegate { sideMenu.backgroundImage = UIImage(named: "Background.jpg") sideMenu.configure(SSASideMenu.MenuViewEffect(fade: true, scale: true, scaleBackground: false)) sideMenu.configure(SSASideMenu.ContentViewEffect(alpha: 1.0, scale: 0.7)) - sideMenu.configure(SSASideMenu.ContentViewShadow(enabled: true, color: UIColor.blackColor(), opacity: 0.6, radius: 6.0)) + sideMenu.configure(SSASideMenu.ContentViewShadow(enabled: true, color: UIColor.black(), opacity: 0.6, radius: 6.0)) sideMenu.delegate = self window?.rootViewController = sideMenu @@ -32,22 +32,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate, SSASideMenuDelegate { return true } - func sideMenuWillShowMenuViewController(sideMenu: SSASideMenu, menuViewController: UIViewController) { + func sideMenuWillShowMenuViewController(_ sideMenu: SSASideMenu, menuViewController: UIViewController) { print("Will Show \(menuViewController)") } - func sideMenuDidShowMenuViewController(sideMenu: SSASideMenu, menuViewController: UIViewController) { + func sideMenuDidShowMenuViewController(_ sideMenu: SSASideMenu, menuViewController: UIViewController) { print("Did Show \(menuViewController)") } - func sideMenuDidHideMenuViewController(sideMenu: SSASideMenu, menuViewController: UIViewController) { + func sideMenuDidHideMenuViewController(_ sideMenu: SSASideMenu, menuViewController: UIViewController) { print("Did Hide \(menuViewController)") } - func sideMenuWillHideMenuViewController(sideMenu: SSASideMenu, menuViewController: UIViewController) { + func sideMenuWillHideMenuViewController(_ sideMenu: SSASideMenu, menuViewController: UIViewController) { print("Will Hide \(menuViewController)") } - func sideMenuDidRecognizePanGesture(sideMenu: SSASideMenu, recongnizer: UIPanGestureRecognizer) { + func sideMenuDidRecognizePanGesture(_ sideMenu: SSASideMenu, recongnizer: UIPanGestureRecognizer) { print("Did Recognize PanGesture \(recongnizer)") } diff --git a/Examples/Simple/SSASideMenuExample/FirstViewController.swift b/Examples/Simple/SSASideMenuExample/FirstViewController.swift index 3ef731c..6bf61bb 100755 --- a/Examples/Simple/SSASideMenuExample/FirstViewController.swift +++ b/Examples/Simple/SSASideMenuExample/FirstViewController.swift @@ -13,10 +13,10 @@ class FirstViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = UIColor.whiteColor() + view.backgroundColor = UIColor.white() title = "Home" - navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Left", style: .Plain, target: self, action: #selector(SSASideMenu.presentLeftMenuViewController)) - navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Right", style: .Plain, target: self, action: #selector(SSASideMenu.presentRightMenuViewController)) + navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Left", style: .plain, target: self, action: #selector(SSASideMenu.presentLeftMenuViewController)) + navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Right", style: .plain, target: self, action: #selector(SSASideMenu.presentRightMenuViewController)) } diff --git a/Examples/Simple/SSASideMenuExample/LeftMenuViewController.swift b/Examples/Simple/SSASideMenuExample/LeftMenuViewController.swift index 6b552d4..cfbfffe 100755 --- a/Examples/Simple/SSASideMenuExample/LeftMenuViewController.swift +++ b/Examples/Simple/SSASideMenuExample/LeftMenuViewController.swift @@ -15,18 +15,18 @@ class LeftMenuViewController: UIViewController { let tableView = UITableView() tableView.delegate = self tableView.dataSource = self - tableView.separatorStyle = .None - tableView.frame = CGRectMake(20, (self.view.frame.size.height - 54 * 5) / 2.0, self.view.frame.size.width, 54 * 5) - tableView.autoresizingMask = [.FlexibleTopMargin, .FlexibleBottomMargin, .FlexibleWidth] - tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell") - tableView.opaque = false - tableView.backgroundColor = UIColor.clearColor() + tableView.separatorStyle = .none + tableView.frame = CGRect(x: 20,y: (self.view.frame.size.height - 54 * 5) / 2.0,width: self.view.frame.size.width,height: 54 * 5) + tableView.autoresizingMask = [.flexibleTopMargin, .flexibleBottomMargin, .flexibleWidth] + tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") + tableView.isOpaque = false + tableView.backgroundColor = UIColor.clear() tableView.backgroundView = nil tableView.bounces = false return tableView }() - override func viewDidAppear(animated: Bool) { + override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) @@ -34,7 +34,7 @@ class LeftMenuViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = UIColor.clearColor() + view.backgroundColor = UIColor.clear() view.addSubview(tableView) } @@ -53,38 +53,38 @@ class LeftMenuViewController: UIViewController { extension LeftMenuViewController: UITableViewDelegate, UITableViewDataSource { - func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 5 } - func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { + func tableView(_ tableView: UITableView, heightForRowAt indexPath: (IndexPath)) -> CGFloat { return 54 } - func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) + let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) let titles: [String] = ["Home", "Calendar", "Profile", "Settings", "Log Out"] let images: [String] = ["IconHome", "IconCalendar", "IconProfile", "IconSettings", "IconEmpty"] - cell.backgroundColor = UIColor.clearColor() + cell.backgroundColor = UIColor.clear() cell.textLabel?.font = UIFont(name: "HelveticaNeue", size: 21) - cell.textLabel?.textColor = UIColor.whiteColor() + cell.textLabel?.textColor = UIColor.white() cell.textLabel?.text = titles[indexPath.row] - cell.selectionStyle = .None + cell.selectionStyle = .none cell.imageView?.image = UIImage(named: images[indexPath.row]) return cell } - func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + tableView.deselectRow(at: indexPath, animated: true) - switch indexPath.row { + switch (indexPath as NSIndexPath).row { case 0: sideMenuViewController?.contentViewController = UINavigationController(rootViewController: FirstViewController()) diff --git a/Examples/Simple/SSASideMenuExample/RightMenuViewController.swift b/Examples/Simple/SSASideMenuExample/RightMenuViewController.swift index 3d46804..0d2838f 100755 --- a/Examples/Simple/SSASideMenuExample/RightMenuViewController.swift +++ b/Examples/Simple/SSASideMenuExample/RightMenuViewController.swift @@ -15,18 +15,18 @@ class RightMenuViewController: UIViewController { let tableView = UITableView() tableView.delegate = self tableView.dataSource = self - tableView.separatorStyle = .None - tableView.frame = CGRectMake(180, (self.view.frame.size.height - 54 * 2) / 2.0, self.view.frame.size.width, 54 * 2) - tableView.autoresizingMask = [.FlexibleTopMargin, .FlexibleBottomMargin, .FlexibleWidth] - tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell") - tableView.opaque = false - tableView.backgroundColor = UIColor.clearColor() + tableView.separatorStyle = .none + tableView.frame = CGRect(x: 180,y: (self.view.frame.size.height - 54 * 2) / 2.0,width: self.view.frame.size.width,height: 54 * 2) + tableView.autoresizingMask = [.flexibleTopMargin, .flexibleBottomMargin, .flexibleWidth] + tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") + tableView.isOpaque = false + tableView.backgroundColor = UIColor.clear() tableView.backgroundView = nil tableView.bounces = false return tableView }() - override func viewDidAppear(animated: Bool) { + override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) @@ -34,7 +34,7 @@ class RightMenuViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = UIColor.clearColor() + view.backgroundColor = UIColor.clear() view.addSubview(tableView) } @@ -53,36 +53,36 @@ class RightMenuViewController: UIViewController { extension RightMenuViewController: UITableViewDelegate, UITableViewDataSource { - func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 2 } - func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 54 } - func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) + let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) let titles: [String] = ["Home", "Calendar"] - cell.backgroundColor = UIColor.clearColor() + cell.backgroundColor = UIColor.clear() cell.textLabel?.font = UIFont(name: "HelveticaNeue", size: 21) - cell.textLabel?.textColor = UIColor.whiteColor() - cell.textLabel?.text = titles[indexPath.row] - cell.selectionStyle = .None + cell.textLabel?.textColor = UIColor.white() + cell.textLabel?.text = titles[(indexPath as NSIndexPath).row] + cell.selectionStyle = .none return cell } - func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: true) + tableView.deselectRow(at: indexPath, animated: true) - switch indexPath.row { + switch (indexPath as NSIndexPath).row { case 0: sideMenuViewController?.contentViewController = UINavigationController(rootViewController: FirstViewController()) diff --git a/Examples/Simple/SSASideMenuExample/SSASideMenu.swift b/Examples/Simple/SSASideMenuExample/SSASideMenu.swift index 456ff55..ab1c648 100755 --- a/Examples/Simple/SSASideMenuExample/SSASideMenu.swift +++ b/Examples/Simple/SSASideMenuExample/SSASideMenu.swift @@ -17,8 +17,8 @@ extension UIViewController { } } - private func getSideViewController(viewController: UIViewController) -> SSASideMenu? { - if let parent = viewController.parentViewController { + private func getSideViewController(_ viewController: UIViewController) -> SSASideMenu? { + if let parent = viewController.parent { if parent is SSASideMenu { return parent as? SSASideMenu }else { @@ -42,46 +42,46 @@ extension UIViewController { @objc protocol SSASideMenuDelegate { - optional func sideMenuDidRecognizePanGesture(sideMenu: SSASideMenu, recongnizer: UIPanGestureRecognizer) - optional func sideMenuWillShowMenuViewController(sideMenu: SSASideMenu, menuViewController: UIViewController) - optional func sideMenuDidShowMenuViewController(sideMenu: SSASideMenu, menuViewController: UIViewController) - optional func sideMenuWillHideMenuViewController(sideMenu: SSASideMenu, menuViewController: UIViewController) - optional func sideMenuDidHideMenuViewController(sideMenu: SSASideMenu, menuViewController: UIViewController) + @objc optional func sideMenuDidRecognizePanGesture(_ sideMenu: SSASideMenu, recongnizer: UIPanGestureRecognizer) + @objc optional func sideMenuWillShowMenuViewController(_ sideMenu: SSASideMenu, menuViewController: UIViewController) + @objc optional func sideMenuDidShowMenuViewController(_ sideMenu: SSASideMenu, menuViewController: UIViewController) + @objc optional func sideMenuWillHideMenuViewController(_ sideMenu: SSASideMenu, menuViewController: UIViewController) + @objc optional func sideMenuDidHideMenuViewController(_ sideMenu: SSASideMenu, menuViewController: UIViewController) } class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { enum SSASideMenuPanDirection: Int { - case Edge = 0 - case EveryWhere = 1 + case edge = 0 + case everyWhere = 1 } enum SSASideMenuType: Int { - case Scale = 0 - case Slip = 1 + case scale = 0 + case slip = 1 } enum SSAStatusBarStyle: Int { - case Hidden = 0 - case Black = 1 - case Light = 2 + case hidden = 0 + case black = 1 + case light = 2 } private enum SSASideMenuSide: Int { - case Left = 0 - case Right = 1 + case left = 0 + case right = 1 } struct ContentViewShadow { var enabled: Bool = true - var color: UIColor = UIColor.blackColor() - var offset: CGSize = CGSizeZero + var color: UIColor = UIColor.black() + var offset: CGSize = CGSize.zero var opacity: Float = 0.4 var radius: Float = 8.0 - init(enabled: Bool = true, color: UIColor = UIColor.blackColor(), offset: CGSize = CGSizeZero, opacity: Float = 0.4, radius: Float = 8.0) { + init(enabled: Bool = true, color: UIColor = UIColor.black(), offset: CGSize = CGSize.zero, opacity: Float = 0.4, radius: Float = 8.0) { self.enabled = false self.color = color @@ -98,9 +98,9 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { var scaleBackground: Bool = true var parallaxEnabled: Bool = true var bouncesHorizontally: Bool = true - var statusBarStyle: SSAStatusBarStyle = .Black + var statusBarStyle: SSAStatusBarStyle = .black - init(fade: Bool = true, scale: Bool = true, scaleBackground: Bool = true, parallaxEnabled: Bool = true, bouncesHorizontally: Bool = true, statusBarStyle: SSAStatusBarStyle = .Black) { + init(fade: Bool = true, scale: Bool = true, scaleBackground: Bool = true, parallaxEnabled: Bool = true, bouncesHorizontally: Bool = true, statusBarStyle: SSAStatusBarStyle = .black) { self.fade = fade self.scale = scale @@ -137,14 +137,14 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { var animationDuration: Float = 0.35 var panGestureEnabled: Bool = true - var panDirection: SSASideMenuPanDirection = .Edge - var type: SSASideMenuType = .Scale + var panDirection: SSASideMenuPanDirection = .edge + var type: SSASideMenuType = .scale var panMinimumOpenThreshold: UInt = 60 - var menuViewControllerTransformation: CGAffineTransform = CGAffineTransformMakeScale(1.5, 1.5) - var backgroundTransformation: CGAffineTransform = CGAffineTransformMakeScale(1.7, 1.7) + var menuViewControllerTransformation: CGAffineTransform = CGAffineTransform(scaleX: 1.5, y: 1.5) + var backgroundTransformation: CGAffineTransform = CGAffineTransform(scaleX: 1.7, y: 1.7) var endAllEditing: Bool = false - init(animationDuration: Float = 0.35, panGestureEnabled: Bool = true, panDirection: SSASideMenuPanDirection = .Edge, type: SSASideMenuType = .Scale, panMinimumOpenThreshold: UInt = 60, menuViewControllerTransformation: CGAffineTransform = CGAffineTransformMakeScale(1.5, 1.5), backgroundTransformation: CGAffineTransform = CGAffineTransformMakeScale(1.7, 1.7), endAllEditing: Bool = false) { + init(animationDuration: Float = 0.35, panGestureEnabled: Bool = true, panDirection: SSASideMenuPanDirection = .edge, type: SSASideMenuType = .scale, panMinimumOpenThreshold: UInt = 60, menuViewControllerTransformation: CGAffineTransform = CGAffineTransform(scaleX: 1.5, y: 1.5), backgroundTransformation: CGAffineTransform = CGAffineTransform(scaleX: 1.7, y: 1.7), endAllEditing: Bool = false) { self.animationDuration = animationDuration self.panGestureEnabled = panGestureEnabled @@ -157,7 +157,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { } } - func configure(configuration: MenuViewEffect) { + func configure(_ configuration: MenuViewEffect) { fadeMenuView = configuration.fade scaleMenuView = configuration.scale scaleBackgroundImageView = configuration.scaleBackground @@ -165,7 +165,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { bouncesHorizontally = configuration.bouncesHorizontally } - func configure(configuration: ContentViewShadow) { + func configure(_ configuration: ContentViewShadow) { contentViewShadowEnabled = configuration.enabled contentViewShadowColor = configuration.color contentViewShadowOffset = configuration.offset @@ -173,7 +173,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { contentViewShadowRadius = configuration.radius } - func configure(configuration: ContentViewEffect) { + func configure(_ configuration: ContentViewEffect) { contentViewScaleValue = configuration.scale contentViewFadeOutAlpha = configuration.alpha contentViewInLandscapeOffsetCenterX = configuration.landscapeOffsetX @@ -182,7 +182,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { parallaxContentMaximumRelativeValue = configuration.maxParallaxContentRelativeValue } - func configure(configuration: SideMenuOptions) { + func configure(_ configuration: SideMenuOptions) { animationDuration = configuration.animationDuration panGestureEnabled = configuration.panGestureEnabled panDirection = configuration.panDirection @@ -206,7 +206,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { @IBInspectable var bouncesHorizontally: Bool = true // MARK : Public Properties: MenuView - @IBInspectable var statusBarStyle: SSAStatusBarStyle = .Black + @IBInspectable var statusBarStyle: SSAStatusBarStyle = .black // MARK : Private Properties: ContentView @IBInspectable var contentViewScaleValue: Float = 0.7 @@ -222,19 +222,19 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { // MARK : Private Properties: Shadow for ContentView @IBInspectable var contentViewShadowEnabled: Bool = true - @IBInspectable var contentViewShadowColor: UIColor = UIColor.blackColor() - @IBInspectable var contentViewShadowOffset: CGSize = CGSizeZero + @IBInspectable var contentViewShadowColor: UIColor = UIColor.black() + @IBInspectable var contentViewShadowOffset: CGSize = CGSize.zero @IBInspectable var contentViewShadowOpacity: Float = 0.4 @IBInspectable var contentViewShadowRadius: Float = 8.0 // MARK : Public Properties: SideMenu @IBInspectable var animationDuration: Float = 0.35 @IBInspectable var panGestureEnabled: Bool = true - @IBInspectable var panDirection: SSASideMenuPanDirection = .Edge - @IBInspectable var type: SSASideMenuType = .Scale + @IBInspectable var panDirection: SSASideMenuPanDirection = .edge + @IBInspectable var type: SSASideMenuType = .scale @IBInspectable var panMinimumOpenThreshold: UInt = 60 - @IBInspectable var menuViewControllerTransformation: CGAffineTransform = CGAffineTransformMakeScale(1.5, 1.5) - @IBInspectable var backgroundTransformation: CGAffineTransform = CGAffineTransformMakeScale(1.7, 1.7) + @IBInspectable var menuViewControllerTransformation: CGAffineTransform = CGAffineTransform(scaleX: 1.5, y: 1.5) + @IBInspectable var backgroundTransformation: CGAffineTransform = CGAffineTransform(scaleX: 1.7, y: 1.7) // MARK : Internal Private Properties @@ -288,7 +288,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { hideViewController(controller) } setupMenuViewControllerMotionEffects() - view.bringSubviewToFront(contentViewContainer) + view.bringSubview(toFront: contentViewContainer) } } @@ -301,7 +301,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { hideViewController(controller) } setupMenuViewControllerMotionEffects() - view.bringSubviewToFront(contentViewContainer) + view.bringSubview(toFront: contentViewContainer) } } @@ -312,7 +312,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { super.init(coder: aDecoder) } - override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { + override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) } @@ -357,18 +357,18 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { if let viewController = rightMenuViewController { - showMenuViewController(.Right, menuViewController: viewController) + showMenuViewController(.right, menuViewController: viewController) - UIView.animateWithDuration(NSTimeInterval(animationDuration), animations: {[unowned self] () -> Void in + UIView.animate(withDuration: TimeInterval(animationDuration), animations: {[unowned self] () -> Void in - self.animateMenuViewController(.Right) + self.animateMenuViewController(.right) self.menuViewContainer.alpha = 1 self.contentViewContainer.alpha = CGFloat(self.contentViewFadeOutAlpha) }, completion: {[unowned self] (Bool) -> Void in - self.animateMenuViewControllerCompletion(.Right, menuViewController: viewController) + self.animateMenuViewControllerCompletion(.right, menuViewController: viewController) }) statusBarNeedsAppearanceUpdate() } @@ -379,17 +379,17 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { if let viewController = leftMenuViewController { - showMenuViewController(.Left, menuViewController: viewController) + showMenuViewController(.left, menuViewController: viewController) - UIView.animateWithDuration(NSTimeInterval(animationDuration), animations: {[unowned self] () -> Void in + UIView.animate(withDuration: TimeInterval(animationDuration), animations: {[unowned self] () -> Void in - self.animateMenuViewController(.Left) + self.animateMenuViewController(.left) self.menuViewContainer.alpha = 1 self.contentViewContainer.alpha = CGFloat(self.contentViewFadeOutAlpha) }, completion: {[unowned self] (Bool) -> Void in - self.animateMenuViewControllerCompletion(.Left, menuViewController: viewController) + self.animateMenuViewControllerCompletion(.left, menuViewController: viewController) }) statusBarNeedsAppearanceUpdate() @@ -397,17 +397,17 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { } } - private func showMenuViewController(side: SSASideMenuSide, menuViewController: UIViewController) { + private func showMenuViewController(_ side: SSASideMenuSide, menuViewController: UIViewController) { - menuViewController.view.hidden = false + menuViewController.view.isHidden = false switch side { - case .Left: + case .left: leftMenuViewController?.beginAppearanceTransition(true, animated: true) - rightMenuViewController?.view.hidden = true - case .Right: + rightMenuViewController?.view.isHidden = true + case .right: rightMenuViewController?.beginAppearanceTransition(true, animated: true) - leftMenuViewController?.view.hidden = true + leftMenuViewController?.view.isHidden = true } if endAllEditing { @@ -420,46 +420,46 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { setupContentViewShadow() resetContentViewScale() - UIApplication.sharedApplication().beginIgnoringInteractionEvents() + UIApplication.shared().beginIgnoringInteractionEvents() } - private func animateMenuViewController(side: SSASideMenuSide) { + private func animateMenuViewController(_ side: SSASideMenuSide) { - if type == .Scale { - contentViewContainer.transform = CGAffineTransformMakeScale(CGFloat(contentViewScaleValue), CGFloat(contentViewScaleValue)) + if type == .scale { + contentViewContainer.transform = CGAffineTransform(scaleX: CGFloat(contentViewScaleValue), y: CGFloat(contentViewScaleValue)) } else { - contentViewContainer.transform = CGAffineTransformIdentity + contentViewContainer.transform = CGAffineTransform.identity } - if side == .Left { - let centerXLandscape = CGFloat(contentViewInLandscapeOffsetCenterX) + (iOS8 ? CGFloat(CGRectGetWidth(view.frame)) : CGFloat(CGRectGetHeight(view.frame))) - let centerXPortrait = CGFloat(contentViewInPortraitOffsetCenterX) + CGFloat(CGRectGetWidth(view.frame)) + if side == .left { + let centerXLandscape = CGFloat(contentViewInLandscapeOffsetCenterX) + (iOS8 ? CGFloat(view.frame.width) : CGFloat(view.frame.height)) + let centerXPortrait = CGFloat(contentViewInPortraitOffsetCenterX) + CGFloat(view.frame.width) - let centerX = UIInterfaceOrientationIsLandscape(UIApplication.sharedApplication().statusBarOrientation) ? centerXLandscape : centerXPortrait + let centerX = UIInterfaceOrientationIsLandscape(UIApplication.shared().statusBarOrientation) ? centerXLandscape : centerXPortrait - contentViewContainer.center = CGPointMake(centerX, contentViewContainer.center.y) + contentViewContainer.center = CGPoint(x: centerX, y: contentViewContainer.center.y) } else { let centerXLandscape = -CGFloat(self.contentViewInLandscapeOffsetCenterX) let centerXPortrait = CGFloat(-self.contentViewInPortraitOffsetCenterX) - let centerX = UIInterfaceOrientationIsLandscape(UIApplication.sharedApplication().statusBarOrientation) ? centerXLandscape : centerXPortrait + let centerX = UIInterfaceOrientationIsLandscape(UIApplication.shared().statusBarOrientation) ? centerXLandscape : centerXPortrait - contentViewContainer.center = CGPointMake(centerX, contentViewContainer.center.y) + contentViewContainer.center = CGPoint(x: centerX, y: contentViewContainer.center.y) } - menuViewContainer.transform = CGAffineTransformIdentity + menuViewContainer.transform = CGAffineTransform.identity if scaleBackgroundImageView { if let _ = backgroundImage { - backgroundImageView.transform = CGAffineTransformIdentity + backgroundImageView.transform = CGAffineTransform.identity } } } - private func animateMenuViewControllerCompletion(side: SSASideMenuSide, menuViewController: UIViewController) { + private func animateMenuViewControllerCompletion(_ side: SSASideMenuSide, menuViewController: UIViewController) { if !visible { self.delegate?.sideMenuDidShowMenuViewController?(self, menuViewController: menuViewController) @@ -468,10 +468,10 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { visible = true switch side { - case .Left: + case .left: leftMenuViewController?.endAppearanceTransition() leftMenuVisible = true - case .Right: + case .right: if contentViewContainer.frame.size.width == view.bounds.size.width && contentViewContainer.frame.size.height == view.bounds.size.height && contentViewContainer.frame.origin.x == 0 && @@ -483,18 +483,18 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { } - UIApplication.sharedApplication().endIgnoringInteractionEvents() + UIApplication.shared().endIgnoringInteractionEvents() setupContentViewControllerMotionEffects() } - private func presentMenuViewContainerWithMenuViewController(menuViewController: UIViewController?) { + private func presentMenuViewContainerWithMenuViewController(_ menuViewController: UIViewController?) { - menuViewContainer.transform = CGAffineTransformIdentity + menuViewContainer.transform = CGAffineTransform.identity menuViewContainer.frame = view.bounds if scaleBackgroundImageView { if backgroundImage != nil { - backgroundImageView.transform = CGAffineTransformIdentity + backgroundImageView.transform = CGAffineTransform.identity backgroundImageView.frame = view.bounds backgroundImageView.transform = backgroundTransformation } @@ -511,7 +511,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { } - private func hideMenuViewController(animated: Bool) { + private func hideMenuViewController(_ animated: Bool) { let isRightMenuVisible: Bool = rightMenuVisible @@ -538,7 +538,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { let animationsClosure: () -> () = {[unowned self] () -> () in - self.contentViewContainer.transform = CGAffineTransformIdentity + self.contentViewContainer.transform = CGAffineTransform.identity self.contentViewContainer.frame = self.view.bounds if self.scaleMenuView { @@ -575,15 +575,15 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { if animated { - UIApplication.sharedApplication().beginIgnoringInteractionEvents() - UIView.animateWithDuration(NSTimeInterval(animationDuration), animations: { () -> Void in + UIApplication.shared().beginIgnoringInteractionEvents() + UIView.animate(withDuration: TimeInterval(animationDuration), animations: { () -> Void in animationsClosure() }, completion: { (Bool) -> Void in completionClosure() - UIApplication.sharedApplication().endIgnoringInteractionEvents() + UIApplication.shared().endIgnoringInteractionEvents() }) }else { @@ -603,14 +603,14 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { if iOS8 { if let cntentViewStoryboardID = contentViewStoryboardID { - contentViewController = storyboard?.instantiateViewControllerWithIdentifier(cntentViewStoryboardID) + contentViewController = storyboard?.instantiateViewController(withIdentifier: cntentViewStoryboardID) } if let lftViewStoryboardID = leftMenuViewStoryboardID { - leftMenuViewController = storyboard?.instantiateViewControllerWithIdentifier(lftViewStoryboardID) + leftMenuViewController = storyboard?.instantiateViewController(withIdentifier: lftViewStoryboardID) } if let rghtViewStoryboardID = rightMenuViewStoryboardID { - rightMenuViewController = storyboard?.instantiateViewControllerWithIdentifier(rghtViewStoryboardID) + rightMenuViewController = storyboard?.instantiateViewController(withIdentifier: rghtViewStoryboardID) } } @@ -620,21 +620,21 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { override func viewDidLoad() { super.viewDidLoad() - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] menuViewContainer.frame = view.bounds; - menuViewContainer.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]; + menuViewContainer.autoresizingMask = [.flexibleWidth, .flexibleHeight]; menuViewContainer.alpha = fadeMenuView ? 0 : 1 contentViewContainer.frame = view.bounds - contentViewContainer.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + contentViewContainer.autoresizingMask = [.flexibleWidth, .flexibleHeight] setupViewController(contentViewContainer, targetViewController: contentViewController) setupViewController(menuViewContainer, targetViewController: leftMenuViewController) setupViewController(menuViewContainer, targetViewController: rightMenuViewController) if panGestureEnabled { - view.multipleTouchEnabled = false + view.isMultipleTouchEnabled = false let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(SSASideMenu.panGestureRecognized(_:))) panGestureRecognizer.delegate = self view.addGestureRecognizer(panGestureRecognizer) @@ -645,8 +645,8 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { backgroundImageView.transform = backgroundTransformation } backgroundImageView.frame = view.bounds - backgroundImageView.contentMode = .ScaleAspectFill; - backgroundImageView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]; + backgroundImageView.contentMode = .scaleAspectFill; + backgroundImageView.autoresizingMask = [.flexibleWidth, .flexibleHeight]; view.addSubview(backgroundImageView) } @@ -661,20 +661,20 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { // MARK : Setup - private func setupViewController(targetView: UIView, targetViewController: UIViewController?) { + private func setupViewController(_ targetView: UIView, targetViewController: UIViewController?) { if let viewController = targetViewController { addChildViewController(viewController) viewController.view.frame = view.bounds - viewController.view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + viewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight] targetView.addSubview(viewController.view) - viewController.didMoveToParentViewController(self) + viewController.didMove(toParentViewController: self) } } - private func hideViewController(targetViewController: UIViewController) { - targetViewController.willMoveToParentViewController(nil) + private func hideViewController(_ targetViewController: UIViewController) { + targetViewController.willMove(toParentViewController: nil) targetViewController.view.removeFromSuperview() targetViewController.removeFromParentViewController() } @@ -686,10 +686,10 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { if let _ = contentButton.superview { return } else { - contentButton.addTarget(self, action: #selector(SSASideMenu.hideMenuViewController as (SSASideMenu) -> () -> ()), forControlEvents:.TouchUpInside) - contentButton.autoresizingMask = .None + contentButton.addTarget(self, action: #selector(SSASideMenu.hideMenuViewController as (SSASideMenu) -> () -> ()), for:.touchUpInside) + contentButton.autoresizingMask = UIViewAutoresizing() contentButton.frame = contentViewContainer.bounds - contentButton.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + contentButton.autoresizingMask = [.flexibleWidth, .flexibleHeight] contentButton.tag = 101 contentViewContainer.addSubview(contentButton) } @@ -698,9 +698,9 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { private func statusBarNeedsAppearanceUpdate() { - if self.respondsToSelector(#selector(UIViewController.setNeedsStatusBarAppearanceUpdate)) { + if self.responds(to: #selector(UIViewController.setNeedsStatusBarAppearanceUpdate)) { - UIView.animateWithDuration(0.3, animations: { () -> Void in + UIView.animate(withDuration: 0.3, animations: { () -> Void in self.setNeedsStatusBarAppearanceUpdate() }) } @@ -711,8 +711,8 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { if contentViewShadowEnabled { let layer: CALayer = contentViewContainer.layer let path: UIBezierPath = UIBezierPath(rect: layer.bounds) - layer.shadowPath = path.CGPath - layer.shadowColor = contentViewShadowColor.CGColor + layer.shadowPath = path.cgPath + layer.shadowColor = contentViewShadowColor.cgColor layer.shadowOffset = contentViewShadowOffset layer.shadowOpacity = contentViewShadowOpacity layer.shadowRadius = CGFloat(contentViewShadowRadius) @@ -726,19 +726,19 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { let t: CGAffineTransform = contentViewContainer.transform let scale: CGFloat = sqrt(t.a * t.a + t.c * t.c) let frame: CGRect = contentViewContainer.frame - contentViewContainer.transform = CGAffineTransformIdentity - contentViewContainer.transform = CGAffineTransformMakeScale(scale, scale) + contentViewContainer.transform = CGAffineTransform.identity + contentViewContainer.transform = CGAffineTransform(scaleX: scale, y: scale) contentViewContainer.frame = frame } - private func setupUserInteractionForContentButtonAndTargetViewControllerView(contentButtonInteractive: Bool, targetViewControllerViewInteractive: Bool) { + private func setupUserInteractionForContentButtonAndTargetViewControllerView(_ contentButtonInteractive: Bool, targetViewControllerViewInteractive: Bool) { if let viewController = contentViewController { for view in viewController.view.subviews { if view.tag == 101 { - view.userInteractionEnabled = contentButtonInteractive + view.isUserInteractionEnabled = contentButtonInteractive }else { - view.userInteractionEnabled = targetViewControllerViewInteractive + view.isUserInteractionEnabled = targetViewControllerViewInteractive } } } @@ -747,7 +747,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { // MARK : Motion Effects (Private) - private func removeMotionEffects(targetView: UIView) { + private func removeMotionEffects(_ targetView: UIView) { let targetViewMotionEffects = targetView.motionEffects for effect in targetViewMotionEffects { targetView.removeMotionEffect(effect) @@ -761,13 +761,13 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { removeMotionEffects(menuViewContainer) // We need to refer to self in closures! - UIView.animateWithDuration(0.2, animations: { [unowned self] () -> Void in + UIView.animate(withDuration: 0.2, animations: { [unowned self] () -> Void in - let interpolationHorizontal: UIInterpolatingMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.x", type: .TiltAlongHorizontalAxis) + let interpolationHorizontal: UIInterpolatingMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.x", type: .tiltAlongHorizontalAxis) interpolationHorizontal.minimumRelativeValue = self.parallaxContentMinimumRelativeValue interpolationHorizontal.maximumRelativeValue = self.parallaxContentMaximumRelativeValue - let interpolationVertical: UIInterpolatingMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.y", type: .TiltAlongVerticalAxis) + let interpolationVertical: UIInterpolatingMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.y", type: .tiltAlongVerticalAxis) interpolationHorizontal.minimumRelativeValue = self.parallaxContentMinimumRelativeValue interpolationHorizontal.maximumRelativeValue = self.parallaxContentMaximumRelativeValue @@ -786,13 +786,13 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { removeMotionEffects(contentViewContainer) // We need to refer to self in closures! - UIView.animateWithDuration(0.2, animations: { [unowned self] () -> Void in + UIView.animate(withDuration: 0.2, animations: { [unowned self] () -> Void in - let interpolationHorizontal: UIInterpolatingMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.x", type: .TiltAlongHorizontalAxis) + let interpolationHorizontal: UIInterpolatingMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.x", type: .tiltAlongHorizontalAxis) interpolationHorizontal.minimumRelativeValue = self.parallaxContentMinimumRelativeValue interpolationHorizontal.maximumRelativeValue = self.parallaxContentMaximumRelativeValue - let interpolationVertical: UIInterpolatingMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.y", type: .TiltAlongVerticalAxis) + let interpolationVertical: UIInterpolatingMotionEffect = UIInterpolatingMotionEffect(keyPath: "center.y", type: .tiltAlongVerticalAxis) interpolationHorizontal.minimumRelativeValue = self.parallaxContentMinimumRelativeValue interpolationHorizontal.maximumRelativeValue = self.parallaxContentMaximumRelativeValue @@ -817,38 +817,38 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { } - override func willAnimateRotationToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) { + override func willAnimateRotation(to toInterfaceOrientation: UIInterfaceOrientation, duration: TimeInterval) { if visible { menuViewContainer.bounds = view.bounds - contentViewContainer.transform = CGAffineTransformIdentity + contentViewContainer.transform = CGAffineTransform.identity contentViewContainer.frame = view.bounds - if type == .Scale { - contentViewContainer.transform = CGAffineTransformMakeScale(CGFloat(contentViewScaleValue), CGFloat(contentViewScaleValue)) + if type == .scale { + contentViewContainer.transform = CGAffineTransform(scaleX: CGFloat(contentViewScaleValue), y: CGFloat(contentViewScaleValue)) } else { - contentViewContainer.transform = CGAffineTransformIdentity + contentViewContainer.transform = CGAffineTransform.identity } var center: CGPoint if leftMenuVisible { - let centerXLandscape = CGFloat(contentViewInLandscapeOffsetCenterX) + (iOS8 ? CGFloat(CGRectGetWidth(view.frame)) : CGFloat(CGRectGetHeight(view.frame))) - let centerXPortrait = CGFloat(contentViewInPortraitOffsetCenterX) + CGFloat(CGRectGetWidth(view.frame)) + let centerXLandscape = CGFloat(contentViewInLandscapeOffsetCenterX) + (iOS8 ? CGFloat(view.frame.width) : CGFloat(view.frame.height)) + let centerXPortrait = CGFloat(contentViewInPortraitOffsetCenterX) + CGFloat(view.frame.width) - let centerX = UIInterfaceOrientationIsLandscape(UIApplication.sharedApplication().statusBarOrientation) ? centerXLandscape : centerXPortrait + let centerX = UIInterfaceOrientationIsLandscape(UIApplication.shared().statusBarOrientation) ? centerXLandscape : centerXPortrait - center = CGPointMake(centerX, contentViewContainer.center.y) + center = CGPoint(x: centerX, y: contentViewContainer.center.y) } else { let centerXLandscape = -CGFloat(self.contentViewInLandscapeOffsetCenterX) let centerXPortrait = CGFloat(-self.contentViewInPortraitOffsetCenterX) - let centerX = UIInterfaceOrientationIsLandscape(UIApplication.sharedApplication().statusBarOrientation) ? centerXLandscape : centerXPortrait + let centerX = UIInterfaceOrientationIsLandscape(UIApplication.shared().statusBarOrientation) ? centerXLandscape : centerXPortrait - center = CGPointMake(centerX, contentViewContainer.center.y) + center = CGPoint(x: centerX, y: contentViewContainer.center.y) } contentViewContainer.center = center @@ -866,12 +866,12 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { var style: UIStatusBarStyle switch statusBarStyle { - case .Hidden: - style = .Default - case .Black: - style = .Default - case .Light: - style = .LightContent + case .hidden: + style = .default + case .black: + style = .default + case .light: + style = .lightContent } if visible || contentViewContainer.frame.origin.y <= 0, let cntViewController = contentViewController { @@ -887,7 +887,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { var statusBarHidden: Bool switch statusBarStyle { - case .Hidden: + case .hidden: statusBarHidden = true default: statusBarHidden = false @@ -903,7 +903,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation { - var statusBarAnimation: UIStatusBarAnimation = .None + var statusBarAnimation: UIStatusBarAnimation = .none if let cntViewController = contentViewController, leftMenuViewController = leftMenuViewController { @@ -935,21 +935,21 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { // MARK : UIGestureRecognizer Delegate (Private) - func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool { + func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { if interactivePopGestureRecognizerEnabled, let viewController = contentViewController as? UINavigationController - where viewController.viewControllers.count > 1 && viewController.interactivePopGestureRecognizer!.enabled { + where viewController.viewControllers.count > 1 && viewController.interactivePopGestureRecognizer!.isEnabled { return false } if gestureRecognizer is UIPanGestureRecognizer && !visible { switch panDirection { - case .EveryWhere: + case .everyWhere: return true - case .Edge: - let point = touch.locationInView(gestureRecognizer.view) + case .edge: + let point = touch.location(in: gestureRecognizer.view) if point.x < 20.0 || point.x > view.frame.size.width - 20.0 { return true } else { return false } } @@ -958,7 +958,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { return true } - func panGestureRecognized(recognizer: UIPanGestureRecognizer) { + func panGestureRecognized(_ recognizer: UIPanGestureRecognizer) { delegate?.sideMenuDidRecognizePanGesture?(self, recongnizer: recognizer) @@ -966,17 +966,17 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { return } - var point: CGPoint = recognizer.translationInView(view) + var point: CGPoint = recognizer.translation(in: view) - if recognizer.state == .Began { + if recognizer.state == .began { setupContentViewShadow() - originalPoint = CGPointMake(contentViewContainer.center.x - CGRectGetWidth(contentViewContainer.bounds) / 2.0, - contentViewContainer.center.y - CGRectGetHeight(contentViewContainer.bounds) / 2.0) - menuViewContainer.transform = CGAffineTransformIdentity + originalPoint = CGPoint(x: contentViewContainer.center.x - contentViewContainer.bounds.width / 2.0, + y: contentViewContainer.center.y - contentViewContainer.bounds.height / 2.0) + menuViewContainer.transform = CGAffineTransform.identity if (scaleBackgroundImageView) { - backgroundImageView.transform = CGAffineTransformIdentity + backgroundImageView.transform = CGAffineTransform.identity backgroundImageView.frame = view.bounds } @@ -992,7 +992,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { didNotifyDelegate = false } - if recognizer.state == .Changed { + if recognizer.state == .changed { var delta: CGFloat = 0.0 if visible { @@ -1003,7 +1003,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { delta = min(fabs(delta), 1.6) - var contentViewScale: CGFloat = type == .Scale ? 1 - ((1 - CGFloat(contentViewScaleValue)) * delta) : 1 + var contentViewScale: CGFloat = type == .scale ? 1 - ((1 - CGFloat(contentViewScaleValue)) * delta) : 1 var backgroundViewScale: CGFloat = backgroundTransformation.a - ((backgroundTransformation.a - 1) * delta) var menuViewScale: CGFloat = menuViewControllerTransformation.a - ((menuViewControllerTransformation.a - 1) * delta) @@ -1018,15 +1018,15 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { contentViewContainer.alpha = 1 - (1 - CGFloat(contentViewFadeOutAlpha)) * delta if scaleBackgroundImageView { - backgroundImageView.transform = CGAffineTransformMakeScale(backgroundViewScale, backgroundViewScale) + backgroundImageView.transform = CGAffineTransform(scaleX: backgroundViewScale, y: backgroundViewScale) } if scaleMenuView { - menuViewContainer.transform = CGAffineTransformMakeScale(menuViewScale, menuViewScale) + menuViewContainer.transform = CGAffineTransform(scaleX: menuViewScale, y: menuViewScale) } if scaleBackgroundImageView && backgroundViewScale < 1 { - backgroundImageView.transform = CGAffineTransformIdentity + backgroundImageView.transform = CGAffineTransform.identity } if bouncesHorizontally && visible { @@ -1042,12 +1042,12 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { // Limit size if point.x < 0 { - point.x = max(point.x, -UIScreen.mainScreen().bounds.size.height) + point.x = max(point.x, -UIScreen.main().bounds.size.height) } else { - point.x = min(point.x, UIScreen.mainScreen().bounds.size.height) + point.x = min(point.x, UIScreen.main().bounds.size.height) } - recognizer.setTranslation(point, inView: view) + recognizer.setTranslation(point, in: view) if !didNotifyDelegate { if point.x > 0 && !visible, let viewController = leftMenuViewController { @@ -1062,23 +1062,23 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { if contentViewScale > 1 { let oppositeScale: CGFloat = (1 - (contentViewScale - 1)) - contentViewContainer.transform = CGAffineTransformMakeScale(oppositeScale, oppositeScale) - contentViewContainer.transform = CGAffineTransformTranslate(contentViewContainer.transform, point.x, 0) + contentViewContainer.transform = CGAffineTransform(scaleX: oppositeScale, y: oppositeScale) + contentViewContainer.transform = contentViewContainer.transform.translateBy(x: point.x, y: 0) } else { - contentViewContainer.transform = CGAffineTransformMakeScale(contentViewScale, contentViewScale) - contentViewContainer.transform = CGAffineTransformTranslate(contentViewContainer.transform, point.x, 0) + contentViewContainer.transform = CGAffineTransform(scaleX: contentViewScale, y: contentViewScale) + contentViewContainer.transform = contentViewContainer.transform.translateBy(x: point.x, y: 0) } - leftMenuViewController?.view.hidden = contentViewContainer.frame.origin.x < 0 - rightMenuViewController?.view.hidden = contentViewContainer.frame.origin.x > 0 + leftMenuViewController?.view.isHidden = contentViewContainer.frame.origin.x < 0 + rightMenuViewController?.view.isHidden = contentViewContainer.frame.origin.x > 0 if leftMenuViewController == nil && contentViewContainer.frame.origin.x > 0 { - contentViewContainer.transform = CGAffineTransformIdentity + contentViewContainer.transform = CGAffineTransform.identity contentViewContainer.frame = view.bounds visible = false leftMenuVisible = false } else if self.rightMenuViewController == nil && contentViewContainer.frame.origin.x < 0 { - contentViewContainer.transform = CGAffineTransformIdentity + contentViewContainer.transform = CGAffineTransform.identity contentViewContainer.frame = view.bounds visible = false rightMenuVisible = false @@ -1087,7 +1087,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { statusBarNeedsAppearanceUpdate() } - if recognizer.state == .Ended { + if recognizer.state == .ended { didNotifyDelegate = false if panMinimumOpenThreshold > 0 && @@ -1103,7 +1103,7 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { hideMenuViewController(false) } - else if recognizer.velocityInView(view).x > 0 { + else if recognizer.velocity(in: view).x > 0 { if contentViewContainer.frame.origin.x < 0 { hideMenuViewController() } else if leftMenuViewController != nil { @@ -1122,4 +1122,4 @@ class SSASideMenu: UIViewController, UIGestureRecognizerDelegate { } -} \ No newline at end of file +} diff --git a/Examples/Simple/SSASideMenuExample/SecondViewController.swift b/Examples/Simple/SSASideMenuExample/SecondViewController.swift index 13cb2f4..f32ddff 100755 --- a/Examples/Simple/SSASideMenuExample/SecondViewController.swift +++ b/Examples/Simple/SSASideMenuExample/SecondViewController.swift @@ -13,11 +13,11 @@ class SecondViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = UIColor.whiteColor() + view.backgroundColor = UIColor.white() title = "Calender" - navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Left", style: .Plain, target: self, action: #selector(SSASideMenu.presentLeftMenuViewController)) - navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Right", style: .Plain, target: self, action: #selector(SSASideMenu.presentRightMenuViewController)) + navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Left", style: .plain, target: self, action: #selector(SSASideMenu.presentLeftMenuViewController)) + navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Right", style: .plain, target: self, action: #selector(SSASideMenu.presentRightMenuViewController)) } @@ -28,4 +28,4 @@ class SecondViewController: UIViewController { } -} \ No newline at end of file +} diff --git a/Examples/Simple/SSASideMenuExampleTests/SSASideMenuExampleTests.swift b/Examples/Simple/SSASideMenuExampleTests/SSASideMenuExampleTests.swift index 6f4b25d..ba63f8f 100755 --- a/Examples/Simple/SSASideMenuExampleTests/SSASideMenuExampleTests.swift +++ b/Examples/Simple/SSASideMenuExampleTests/SSASideMenuExampleTests.swift @@ -28,7 +28,7 @@ class SSASideMenuExampleTests: XCTestCase { func testPerformanceExample() { // This is an example of a performance test case. - self.measureBlock() { + self.measure() { // Put the code you want to measure the time of here. } }