Skip to content

Updated swift 4.2.0 #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2.0
14 changes: 7 additions & 7 deletions DrawerController.podspec → AMDrawerController.podspec
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Pod::Spec.new do |s|
s.name = 'DrawerController'
s.version = '4.0.0'
s.name = 'AMDrawerController'
s.version = '4.2.4'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.homepage = 'https://github.com/sascha/DrawerController'
s.homepage = 'https://github.com/Anumothu/DrawerController'
s.authors = { 'Sascha Schwabbauer' => '[email protected]',
'Malte Baumann' => '[email protected]' }
'Malte Baumann' => '[email protected]','Alen' => '[email protected]' }
s.summary = 'A lightweight, easy-to-use side drawer navigation controller (Swift port of MMDrawerController).'
s.social_media_url = 'http://twitter.com/_saschas'
s.source = { :git => 'https://github.com/sascha/DrawerController.git', :tag => s.version.to_s }
s.source = { :git => 'https://github.com/Anumothu/DrawerController.git', :tag => s.version.to_s }

s.requires_arc = true
s.ios.deployment_target = '8.0'
s.ios.deployment_target = '9.0'

s.subspec 'Core' do |ss|
ss.source_files = 'DrawerController/DrawerController.swift', 'DrawerController/DrawerSegue.swift'
Expand All @@ -19,6 +19,6 @@ Pod::Spec.new do |s|

s.subspec 'DrawerVisualStates' do |ss|
ss.source_files = 'DrawerController/DrawerBarButtonItem.swift', 'DrawerController/AnimatedMenuButton.swift', 'DrawerController/DrawerVisualState.swift'
ss.dependency 'DrawerController/Core'
ss.dependency 'AMDrawerController/Core'
end
end
4 changes: 2 additions & 2 deletions DrawerController.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -312,7 +312,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 2 additions & 2 deletions DrawerController/AnimatedMenuButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ open class AnimatedMenuButton : UIButton {
layer.strokeColor = self.strokeColor.cgColor
layer.lineWidth = 1
layer.miterLimit = 2
layer.lineCap = kCALineCapSquare
layer.lineCap = CAShapeLayerLineCap.square
layer.masksToBounds = true

if let path = layer.path, let strokingPath = CGPath(__byStroking: path, transform: nil, lineWidth: 1, lineCap: .square, lineJoin: .miter, miterLimit: 4) {
Expand Down Expand Up @@ -147,7 +147,7 @@ open class AnimatedMenuButton : UIButton {
let topTransform = CABasicAnimation(keyPath: "transform")
topTransform.timingFunction = CAMediaTimingFunction(controlPoints: 0.5, -0.8, 0.5, 1.85)
topTransform.duration = animationDuration
topTransform.fillMode = kCAFillModeBackwards
topTransform.fillMode = CAMediaTimingFillMode.backwards

let bottomTransform = topTransform.copy() as! CABasicAnimation

Expand Down
2 changes: 1 addition & 1 deletion DrawerController/DrawerBarButtonItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ open class DrawerBarButtonItem: UIBarButtonItem {
public convenience init(target: AnyObject?, action: Selector, menuIconColor: UIColor, animatable: Bool) {
let menuButton = AnimatedMenuButton(frame: CGRect(x: 0, y: 0, width: 26, height: 26), strokeColor: menuIconColor)
menuButton.animatable = animatable
menuButton.addTarget(target, action: action, for: UIControlEvents.touchUpInside)
menuButton.addTarget(target, action: action, for: UIControl.Event.touchUpInside)
self.init(customView: menuButton)

self.menuButton = menuButton
Expand Down
40 changes: 20 additions & 20 deletions DrawerController/DrawerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private func bounceKeyFrameAnimation(forDistance distance: CGFloat, on view: UIV
let animation = CAKeyframeAnimation(keyPath: "position.x")
animation.repeatCount = 1
animation.duration = 0.8
animation.fillMode = kCAFillModeForwards
animation.fillMode = CAMediaTimingFillMode.forwards
animation.values = values
animation.isRemovedOnCompletion = true
animation.autoreverses = false
Expand Down Expand Up @@ -543,11 +543,11 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {

// MARK: - UIViewController Containment

override open var childViewControllerForStatusBarHidden : UIViewController? {
override open var childForStatusBarHidden : UIViewController? {
return self.childViewController(for: self.openSide)
}

override open var childViewControllerForStatusBarStyle : UIViewController? {
override open var childForStatusBarStyle : UIViewController? {
return self.childViewController(for: self.openSide)
}

Expand Down Expand Up @@ -704,7 +704,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
}

if let sideDrawerViewControllerToHide = self.sideDrawerViewController(for: drawerToHide) {
self.childControllerContainerView.sendSubview(toBack: sideDrawerViewControllerToHide.view)
self.childControllerContainerView.sendSubviewToBack(sideDrawerViewControllerToHide.view)
sideDrawerViewControllerToHide.view.isHidden = true
}

Expand Down Expand Up @@ -844,11 +844,11 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
currentSideViewController!.beginAppearanceTransition(false, animated: false)
currentSideViewController!.view.removeFromSuperview()
currentSideViewController!.endAppearanceTransition()
currentSideViewController!.willMove(toParentViewController: nil)
currentSideViewController!.removeFromParentViewController()
currentSideViewController!.willMove(toParent: nil)
currentSideViewController!.removeFromParent()
}

var autoResizingMask = UIViewAutoresizing()
var autoResizingMask = UIView.AutoresizingMask()

if drawerSide == .left {
self._leftDrawerViewController = viewController
Expand All @@ -859,19 +859,19 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
}

if viewController != nil {
self.addChildViewController(viewController!)
self.addChild(viewController!)

if (self.openSide == drawerSide) && (self.childControllerContainerView.subviews as NSArray).contains(self.centerContainerView) {
self.childControllerContainerView.insertSubview(viewController!.view, belowSubview: self.centerContainerView)
viewController!.beginAppearanceTransition(true, animated: false)
viewController!.endAppearanceTransition()
} else {
self.childControllerContainerView.addSubview(viewController!.view)
self.childControllerContainerView.sendSubview(toBack: viewController!.view)
self.childControllerContainerView.sendSubviewToBack(viewController!.view)
viewController!.view.isHidden = true
}

viewController!.didMove(toParentViewController: self)
viewController!.didMove(toParent: self)
viewController!.view.autoresizingMask = autoResizingMask
viewController!.view.frame = viewController!.evo_visibleDrawerFrame
}
Expand All @@ -885,13 +885,13 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
}

if let oldCenterViewController = self._centerViewController {
oldCenterViewController.willMove(toParentViewController: nil)
oldCenterViewController.willMove(toParent: nil)

if animated == false {
oldCenterViewController.beginAppearanceTransition(false, animated: false)
}

oldCenterViewController.removeFromParentViewController()
oldCenterViewController.removeFromParent()
oldCenterViewController.view.removeFromSuperview()

if animated == false {
Expand All @@ -902,10 +902,10 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self._centerViewController = centerViewController

if self._centerViewController != nil {
self.addChildViewController(self._centerViewController!)
self.addChild(self._centerViewController!)
self._centerViewController!.view.frame = self.childControllerContainerView.bounds
self.centerContainerView.addSubview(self._centerViewController!.view)
self.childControllerContainerView.bringSubview(toFront: self.centerContainerView)
self.childControllerContainerView.bringSubviewToFront(self.centerContainerView)
self._centerViewController!.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.updateShadowForCenterView()

Expand All @@ -916,7 +916,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self._centerViewController!.endAppearanceTransition()
}

self._centerViewController!.didMove(toParentViewController: self)
self._centerViewController!.didMove(toParent: self)
}
}
}
Expand Down Expand Up @@ -952,7 +952,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self.closeDrawer(animated: animated, completion: { (finished) in
if forwardAppearanceMethodsToCenterViewController {
self.centerViewController!.endAppearanceTransition()
self.centerViewController!.didMove(toParentViewController: self)
self.centerViewController!.didMove(toParent: self)
}

completion?(finished)
Expand Down Expand Up @@ -1022,7 +1022,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
}, completion: { (finished) -> Void in
if forwardAppearanceMethodsToCenterViewController {
self.centerViewController?.endAppearanceTransition()
self.centerViewController?.didMove(toParentViewController: self)
self.centerViewController?.didMove(toParent: self)
}

sideDrawerViewController?.endAppearanceTransition()
Expand Down Expand Up @@ -1232,7 +1232,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self.openDrawerSide(drawerSide, animated: animated, velocity: self.animationVelocity, animationOptions: [], completion: completion)
}

fileprivate func openDrawerSide(_ drawerSide: DrawerSide, animated: Bool, velocity: CGFloat, animationOptions options: UIViewAnimationOptions, completion: ((Bool) -> Void)?) {
fileprivate func openDrawerSide(_ drawerSide: DrawerSide, animated: Bool, velocity: CGFloat, animationOptions options: UIView.AnimationOptions, completion: ((Bool) -> Void)?) {
assert({ () -> Bool in
return drawerSide != .none
}(), "drawerSide cannot be .None")
Expand Down Expand Up @@ -1293,7 +1293,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self.closeDrawer(animated: animated, velocity: self.animationVelocity, animationOptions: [], completion: completion)
}

fileprivate func closeDrawer(animated: Bool, velocity: CGFloat, animationOptions options: UIViewAnimationOptions, completion: ((Bool) -> Void)?) {
fileprivate func closeDrawer(animated: Bool, velocity: CGFloat, animationOptions options: UIView.AnimationOptions, completion: ((Bool) -> Void)?) {
if self.animatingDrawer {
completion?(false)
} else {
Expand Down Expand Up @@ -1445,7 +1445,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
if oldShadowPath != nil {
let transition = CABasicAnimation(keyPath: "shadowPath")
transition.fromValue = oldShadowPath
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.duration = context.transitionDuration
self.centerContainerView.layer.add(transition, forKey: "transition")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -525,7 +525,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "io.evolved.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
23 changes: 13 additions & 10 deletions KitchenSink/ExampleFiles/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var drawerController: DrawerController!

func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let leftSideDrawerViewController = ExampleLeftSideDrawerViewController()
let centerViewController = ExampleCenterTableViewController()
let rightSideDrawerViewController = ExampleRightSideDrawerViewController()
Expand Down Expand Up @@ -63,23 +63,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window?.backgroundColor = UIColor.white
self.window?.makeKeyAndVisible()

return true
}

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
self.window?.backgroundColor = UIColor.white
self.window?.makeKeyAndVisible()

return true
}

func application(_ application: UIApplication, shouldSaveApplicationState coder: NSCoder) -> Bool {
return true
}

func application(_ application: UIApplication, shouldRestoreApplicationState coder: NSCoder) -> Bool {
return true
}

func application(_ application: UIApplication, viewControllerWithRestorationIdentifierPath identifierComponents: [Any], coder: NSCoder) -> UIViewController? {
if let key = identifierComponents.last as? String {


func application(_ application: UIApplication, viewControllerWithRestorationIdentifierPath identifierComponents: [String], coder: NSCoder) -> UIViewController? {

if let key = identifierComponents.last {
if key == "Drawer" {
return self.window?.rootViewController
} else if key == "ExampleCenterNavigationControllerRestorationKey" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import UIKit

class CenterTableViewCell: TableViewCell {
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.accessoryCheckmarkColor = UIColor(red: 13 / 255, green: 88 / 255, blue: 161 / 255, alpha: 1.0)
}
Expand All @@ -32,6 +32,6 @@ class CenterTableViewCell: TableViewCell {
}

override func updateContentForNewContentSize() {
self.textLabel?.font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.body)
self.textLabel?.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SideDrawerSectionHeaderView: UIView {
func commonSetup() {
self.backgroundColor = UIColor(red: 110 / 255, green: 113 / 255, blue: 115 / 255, alpha: 1.0)
self.label = UILabel(frame: CGRect(x: 15, y: self.bounds.maxY - 28, width: self.bounds.width - 30, height: 22))
self.label.font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.caption1)
self.label.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.caption1)
self.label.backgroundColor = UIColor.clear
self.label.textColor = UIColor(red: 203 / 255, green: 206 / 255, blue: 209 / 255, alpha: 1.0)
self.label.autoresizingMask = [ .flexibleWidth ,.flexibleTopMargin ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import UIKit

class SideDrawerTableViewCell: TableViewCell {
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {


override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.commonSetup()
}
Expand All @@ -45,6 +47,6 @@ class SideDrawerTableViewCell: TableViewCell {
}

override func updateContentForNewContentSize() {
self.textLabel?.font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.body)
self.textLabel?.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
}
}
4 changes: 2 additions & 2 deletions KitchenSink/ExampleFiles/TableViewHelpers/TableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private class CustomCheckmark: UIControl {
class TableViewCell: UITableViewCell {
var accessoryCheckmarkColor: UIColor = UIColor.white
var disclosureIndicatorColor: UIColor = UIColor.white
override var accessoryType: UITableViewCellAccessoryType {
override var accessoryType: UITableViewCell.AccessoryType {
didSet {
if self.accessoryType == .checkmark {
let customCheckmark = CustomCheckmark(frame: CGRect(x: 0, y: 0, width: 15, height: 15))
Expand All @@ -141,7 +141,7 @@ class TableViewCell: UITableViewCell {
}
}

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

self.updateContentForNewContentSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ExampleSideDrawerViewController: ExampleViewController, UITableViewDataSou
self.tableView.separatorStyle = .none

self.navigationController?.navigationBar.barTintColor = UIColor(red: 161 / 255, green: 164 / 255, blue: 166 / 255, alpha: 1.0)
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor(red: 55 / 255, green: 70 / 255, blue: 77 / 255, alpha: 1.0)]
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor(red: 55 / 255, green: 70 / 255, blue: 77 / 255, alpha: 1.0)]

self.view.backgroundColor = UIColor.clear
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class ExampleViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

NotificationCenter.default.addObserver(self, selector: #selector(contentSizeDidChangeNotification(_:)), name: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeDidChangeNotification(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil)
}

@objc fileprivate func contentSizeDidChangeNotification(_ notification: Notification) {
if let userInfo: NSDictionary = (notification as NSNotification).userInfo as NSDictionary? {
self.contentSizeDidChange(userInfo[UIContentSizeCategoryNewValueKey] as! String)
self.contentSizeDidChange(userInfo[UIContentSizeCategory.newValueUserInfoKey] as! String)
}
}

Expand Down
Loading