Skip to content
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

Update for Swift 4.2 support #418

Open
wants to merge 1 commit 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
4.2.0 Release notes (2019-01-11)
=============================================================

### Enhancements
* Support Swift4.2

### Bugfixes
* None.

4.0.0 Release notes (2017-10-31)
=============================================================

Expand Down
3 changes: 2 additions & 1 deletion SlideMenuControllerSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SlideMenuControllerSwift"
s.version = "4.0.0"
s.version = "4.2.0"
s.summary = "iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app."
s.homepage = "https://github.com/dekatotoro/SlideMenuControllerSwift"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand All @@ -11,4 +11,5 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/dekatotoro/SlideMenuControllerSwift.git", :tag => s.version }
s.source_files = "Source/*.swift"
s.requires_arc = true
s.swift_version = "4.2"
end
24 changes: 13 additions & 11 deletions SlideMenuControllerSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
0E75C5A31BE3CA9F00844634 /* SlideMenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5BA8AA51A43E2EF00863FB9 /* SlideMenuController.swift */; };
0E75C5A61BE3CAFE00844634 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0E75C5A41BE3CAFE00844634 /* Info.plist */; };
0EB8EBFF1BE3CF3C00BC2A99 /* SlideMenuControllerSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E75C5A51BE3CAFE00844634 /* SlideMenuControllerSwift.h */; settings = {ATTRIBUTES = (Public, ); }; };
C539E6471A315E87003B7CC7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C539E6461A315E87003B7CC7 /* AppDelegate.swift */; };
C539E64A1A315E87003B7CC7 /* SlideMenuControllerSwift.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = C539E6481A315E87003B7CC7 /* SlideMenuControllerSwift.xcdatamodeld */; };
Expand Down Expand Up @@ -323,19 +322,19 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Yuji Hato";
TargetAttributes = {
0E75C5951BE3CA7900844634 = {
CreatedOnToolsVersion = 7.1;
};
C539E6401A315E87003B7CC7 = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 1010;
};
C539E6581A315E87003B7CC7 = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 1010;
TestTargetID = C539E6401A315E87003B7CC7;
};
};
Expand Down Expand Up @@ -375,7 +374,6 @@
C5498C801BE897660076A7C5 /* ImageHeaderView.xib in Resources */,
C5BF6A8A1BF3335D0064C18E /* SubContentsViewController.storyboard in Resources */,
C5BF6A841BEEF1E70064C18E /* DataTableViewCell.xib in Resources */,
0E75C5A61BE3CAFE00844634 /* Info.plist in Resources */,
C539E64F1A315E87003B7CC7 /* Main.storyboard in Resources */,
C539E6541A315E87003B7CC7 /* LaunchScreen.xib in Resources */,
C539E6511A315E87003B7CC7 /* Images.xcassets in Resources */,
Expand Down Expand Up @@ -487,7 +485,7 @@
PRODUCT_BUNDLE_IDENTIFIER = dekatotoro.SlideMenuControllerSwift;
PRODUCT_NAME = "$(PROJECT_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -512,7 +510,7 @@
PRODUCT_BUNDLE_IDENTIFIER = dekatotoro.SlideMenuControllerSwift;
PRODUCT_NAME = "$(PROJECT_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -530,12 +528,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -584,12 +584,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -628,7 +630,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "dekatotoro.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -643,7 +645,7 @@
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "dekatotoro.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -661,7 +663,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "dekatotoro.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SlideMenuControllerSwift.app/SlideMenuControllerSwift";
};
name = Debug;
Expand All @@ -675,7 +677,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "dekatotoro.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SlideMenuControllerSwift.app/SlideMenuControllerSwift";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?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/>
</plist>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -37,7 +36,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion SlideMenuControllerSwift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
self.window?.makeKeyAndVisible()
}

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

self.createMenuView()

Expand Down
2 changes: 1 addition & 1 deletion SlideMenuControllerSwift/BaseTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ open class BaseTableViewCell : UITableViewCell {
setup()
}

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setup()
}
Expand Down
2 changes: 1 addition & 1 deletion SlideMenuControllerSwift/LeftViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extension LeftViewController : UITableViewDataSource {
if let menu = LeftMenu(rawValue: indexPath.row) {
switch menu {
case .main, .swift, .java, .go, .nonMenu:
let cell = BaseTableViewCell(style: UITableViewCellStyle.subtitle, reuseIdentifier: BaseTableViewCell.identifier)
let cell = BaseTableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: BaseTableViewCell.identifier)
cell.setData(menus[indexPath.row])
return cell
}
Expand Down
46 changes: 23 additions & 23 deletions Source/SlideMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct SlideMenuOptions {
public static var shadowOffset: CGSize = CGSize(width: 0,height: 0)
public static var panFromBezel: Bool = true
public static var animationDuration: CGFloat = 0.4
public static var animationOptions: UIViewAnimationOptions = []
public static var animationOptions: UIView.AnimationOptions = []
public static var rightViewWidth: CGFloat = 270.0
public static var rightBezelWidth: CGFloat? = 16.0
public static var rightPanFromBezel: Bool = true
Expand Down Expand Up @@ -128,7 +128,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
opacityframe.size.height = opacityframe.size.height - opacityOffset
opacityView = UIView(frame: opacityframe)
opacityView.backgroundColor = SlideMenuOptions.opacityViewBackgroundColor
opacityView.autoresizingMask = [UIViewAutoresizing.flexibleHeight, UIViewAutoresizing.flexibleWidth]
opacityView.autoresizingMask = [UIView.AutoresizingMask.flexibleHeight, UIView.AutoresizingMask.flexibleWidth]
opacityView.layer.opacity = 0.0
view.insertSubview(opacityView, at: 1)

Expand All @@ -141,7 +141,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
leftFrame.size.height = leftFrame.size.height - leftOffset
leftContainerView = UIView(frame: leftFrame)
leftContainerView.backgroundColor = UIColor.clear
leftContainerView.autoresizingMask = UIViewAutoresizing.flexibleHeight
leftContainerView.autoresizingMask = UIView.AutoresizingMask.flexibleHeight
view.insertSubview(leftContainerView, at: 2)
addLeftGestures()
}
Expand All @@ -155,7 +155,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
rightFrame.size.height = rightFrame.size.height - rightOffset
rightContainerView = UIView(frame: rightFrame)
rightContainerView.backgroundColor = UIColor.clear
rightContainerView.autoresizingMask = UIViewAutoresizing.flexibleHeight
rightContainerView.autoresizingMask = UIView.AutoresizingMask.flexibleHeight
view.insertSubview(rightContainerView, at: 3)
addRightGestures()
}
Expand Down Expand Up @@ -356,7 +356,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
static var startPointOfPan: CGPoint = CGPoint.zero
static var wasOpenAtStartOfPan: Bool = false
static var wasHiddenAtStartOfPan: Bool = false
static var lastState : UIGestureRecognizerState = .ended
static var lastState : UIGestureRecognizer.State = .ended
}

@objc func handleLeftPanGesture(_ panGesture: UIPanGestureRecognizer) {
Expand All @@ -370,7 +370,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
}

switch panGesture.state {
case UIGestureRecognizerState.began:
case UIGestureRecognizer.State.began:
if LeftPanState.lastState != .ended && LeftPanState.lastState != .cancelled && LeftPanState.lastState != .failed {
return
}
Expand All @@ -389,7 +389,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
leftViewController?.beginAppearanceTransition(LeftPanState.wasHiddenAtStartOfPan, animated: true)
addShadowToView(leftContainerView)
setOpenWindowLevel()
case UIGestureRecognizerState.changed:
case UIGestureRecognizer.State.changed:
if LeftPanState.lastState != .began && LeftPanState.lastState != .changed {
return
}
Expand All @@ -398,7 +398,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
leftContainerView.frame = applyLeftTranslation(translation, toFrame: LeftPanState.frameAtStartOfPan)
applyLeftOpacity()
applyLeftContentViewScale()
case UIGestureRecognizerState.ended, UIGestureRecognizerState.cancelled:
case UIGestureRecognizer.State.ended, UIGestureRecognizer.State.cancelled:
if LeftPanState.lastState != .changed {
setCloseWindowLevel()
return
Expand All @@ -424,7 +424,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
track(.leftFlickClose)

}
case UIGestureRecognizerState.failed, UIGestureRecognizerState.possible:
case UIGestureRecognizer.State.failed, UIGestureRecognizer.State.possible:
break
}

Expand All @@ -436,7 +436,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
static var startPointOfPan: CGPoint = CGPoint.zero
static var wasOpenAtStartOfPan: Bool = false
static var wasHiddenAtStartOfPan: Bool = false
static var lastState : UIGestureRecognizerState = .ended
static var lastState : UIGestureRecognizer.State = .ended
}

@objc func handleRightPanGesture(_ panGesture: UIPanGestureRecognizer) {
Expand All @@ -450,7 +450,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
}

switch panGesture.state {
case UIGestureRecognizerState.began:
case UIGestureRecognizer.State.began:
if RightPanState.lastState != .ended && RightPanState.lastState != .cancelled && RightPanState.lastState != .failed {
return
}
Expand All @@ -470,7 +470,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {

addShadowToView(rightContainerView)
setOpenWindowLevel()
case UIGestureRecognizerState.changed:
case UIGestureRecognizer.State.changed:
if RightPanState.lastState != .began && RightPanState.lastState != .changed {
return
}
Expand All @@ -480,7 +480,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
applyRightOpacity()
applyRightContentViewScale()

case UIGestureRecognizerState.ended, UIGestureRecognizerState.cancelled:
case UIGestureRecognizer.State.ended, UIGestureRecognizer.State.cancelled:
if RightPanState.lastState != .changed {
setCloseWindowLevel()
return
Expand All @@ -505,7 +505,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {

track(.rightFlickClose)
}
case UIGestureRecognizerState.failed, UIGestureRecognizerState.possible:
case UIGestureRecognizer.State.failed, UIGestureRecognizer.State.possible:
break
}

Expand Down Expand Up @@ -900,7 +900,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
if SlideMenuOptions.hideStatusBar {
DispatchQueue.main.async(execute: {
if let window = UIApplication.shared.keyWindow {
window.windowLevel = UIWindowLevelStatusBar + 1
window.windowLevel = UIWindow.Level.statusBar + 1
}
})
}
Expand All @@ -910,7 +910,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
if SlideMenuOptions.hideStatusBar {
DispatchQueue.main.async(execute: {
if let window = UIApplication.shared.keyWindow {
window.windowLevel = UIWindowLevelNormal
window.windowLevel = UIWindow.Level.normal
}
})
}
Expand All @@ -920,10 +920,10 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
if let viewController = targetViewController {
viewController.view.frame = targetView.bounds

if (!childViewControllers.contains(viewController)) {
addChildViewController(viewController)
if (!children.contains(viewController)) {
addChild(viewController)
targetView.addSubview(viewController.view)
viewController.didMove(toParentViewController: self)
viewController.didMove(toParent: self)
}
}
}
Expand All @@ -932,9 +932,9 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
fileprivate func removeViewController(_ viewController: UIViewController?) {
if let _viewController = viewController {
_viewController.view.layer.removeAllAnimations()
_viewController.willMove(toParentViewController: nil)
_viewController.willMove(toParent: nil)
_viewController.view.removeFromSuperview()
_viewController.removeFromParentViewController()
_viewController.removeFromParent()
}
}

Expand Down Expand Up @@ -1042,12 +1042,12 @@ extension UIViewController {
}

public func addLeftBarButtonWithImage(_ buttonImage: UIImage) {
let leftButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.toggleLeft))
let leftButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.toggleLeft))
navigationItem.leftBarButtonItem = leftButton
}

public func addRightBarButtonWithImage(_ buttonImage: UIImage) {
let rightButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.toggleRight))
let rightButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.toggleRight))
navigationItem.rightBarButtonItem = rightButton
}

Expand Down