Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Example/KWDrawerController-Example.xcodeproj/project.xcworkspace/xcuserdata/kawoou.xcuserdatad/UserInterfaceState.xcuserstate
  • Loading branch information
kawoou committed May 16, 2017
2 parents f983563 + 1322087 commit ae88053
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 73 deletions.
8 changes: 4 additions & 4 deletions DrawerController/Animator/DrawerBackEaseAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ public class DrawerBackEaseAnimator: DrawerTickAnimator {
internal func algorithm(value: Double) -> Double {
switch self {
case .easeIn:
return pow(value, 3) - value * sin(value * M_PI)
return pow(value, 3) - value * sin(value * Double.pi / 2)
case .easeOut:
let newValue = 1 - value
return 1 - (pow(newValue, 3) - newValue * sin(newValue * M_PI))
return 1 - (pow(newValue, 3) - newValue * sin(newValue * Double.pi / 2))
case .easeInOut:
if value < 0.5 {
let newValue = 2 * value
return 0.5 * (pow(newValue, 3) - newValue * sin(newValue * M_PI))
return 0.5 * (pow(newValue, 3) - newValue * sin(newValue * Double.pi / 2))
} else {
let newValue = (1 - (2 * value - 1))
return 0.5 * (1 - (pow(newValue, 3) - newValue * sin(newValue * M_PI))) + 0.5
return 0.5 * (1 - (pow(newValue, 3) - newValue * sin(newValue * Double.pi / 2))) + 0.5
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions DrawerController/Animator/DrawerElasticEaseAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public class DrawerElasticEaseAnimator: DrawerTickAnimator {
internal func algorithm(value: Double) -> Double {
switch self {
case .easeIn:
return sin(13 * M_PI_2 * value) * pow(2, 10 * (value - 1))
return sin(13 * Double.pi / 2 * value) * pow(2, 10 * (value - 1))
case .easeOut:
return sin(-13 * M_PI_2 * (value + 1)) * pow(2, -10 * value) + 1
return sin(-13 * Double.pi / 2 * (value + 1)) * pow(2, -10 * value) + 1
case .easeInOut:
if value < 0.5 {
return 0.5 * sin(13 * M_PI_2 * (2 * value)) * pow(2, 10 * ((2 * value) - 1))
return 0.5 * sin(13 * Double.pi / 2 * (2 * value)) * pow(2, 10 * ((2 * value) - 1))
} else {
return 0.5 * (sin(-13 * M_PI_2 * ((2 * value - 1) + 1)) * pow(2, -10 * (2 * value - 1)) + 2)
return 0.5 * (sin(-13 * Double.pi / 2 * ((2 * value - 1) + 1)) * pow(2, -10 * (2 * value - 1)) + 2)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions DrawerController/Animator/DrawerSineEaseAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class DrawerSineEaseAnimator: DrawerTickAnimator {
internal func algorithm(value: Double) -> Double {
switch self {
case .easeIn:
return sin((value - 1) * M_PI_2) + 1
return sin((value - 1) * Double.pi / 2) + 1
case .easeOut:
return sin(value * M_PI_2)
return sin(value * Double.pi / 2)
case .easeInOut:
return 0.5 * (1 - cos(value * M_PI))
return 0.5 * (1 - cos(value * Double.pi / 2))
}
}
}
Expand Down
34 changes: 32 additions & 2 deletions DrawerController/DrawerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
}

private func willBeginAnimate(side: DrawerSide) {
#if DEBUG
print("willBeginAnimate(side: \(side.rawValue))")
#endif

for (drawerSide, content) in self.contentMap {
if drawerSide == side || drawerSide == .none || drawerSide == self.internalFromSide {
Expand All @@ -565,7 +567,9 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self.view.isUserInteractionEnabled = false
}
private func didBeginAnimate(side: DrawerSide) {
#if DEBUG
print("didBeginAnimate(side: \(side.rawValue))")
#endif

/// Golden-Path
guard let mainContent = contentMap[.none] else { return }
Expand Down Expand Up @@ -621,10 +625,14 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self.delegate?.drawerDidBeganAnimation?(drawerController: self, side: side)
}
private func willAnimate(side: DrawerSide, percent: Float) {
#if DEBUG
print("willAnimate(side: \(side.rawValue), percent: \(percent))")
#endif
}
private func didAnimate(side: DrawerSide, percent: Float) {
#if DEBUG
print("didAnimate(side: \(side.rawValue), percent: \(percent))")
#endif

/// Golden-Path
guard let mainContent = contentMap[.none] else { return }
Expand Down Expand Up @@ -675,13 +683,17 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self.delegate?.drawerDidAnimation?(drawerController: self, side: side, percentage: percent)
}
private func willFinishAnimate(side: DrawerSide, percent: Float) {
#if DEBUG
print("willFinishAnimate(side: \(side.rawValue), percent: \(percent))")
#endif

/// Delegate
self.delegate?.drawerWillFinishAnimation?(drawerController: self, side: side)
}
private func didFinishAnimate(side: DrawerSide, percent: Float) {
#if DEBUG
print("didFinishAnimate(side: \(side.rawValue), percent: \(percent))")
#endif

/// Golden-Path
guard let mainContent = contentMap[.none] else { return }
Expand Down Expand Up @@ -734,13 +746,17 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self.delegate?.drawerDidFinishAnimation?(drawerController: self, side: side)
}
private func willCancelAnimate(side: DrawerSide, percent: Float) {
#if DEBUG
print("willCancelAnimate(side: \(side.rawValue), percent: \(percent))")
#endif

/// Delegate
self.delegate?.drawerWillCancelAnimation?(drawerController: self, side: side)
}
private func didCancelAnimate(side: DrawerSide, percent: Float) {
#if DEBUG
print("didCancelAnimate(side: \(side.rawValue), percent: \(percent))")
#endif

/// Golden-Path
guard let mainContent = contentMap[.none] else { return }
Expand Down Expand Up @@ -940,8 +956,22 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate {
self.gestureLastPercentage = -1.0
}
} else {
self.closeSide {
self.gestureLastPercentage = -1.0
if fabs(self.gestureLastPercentage) > 1.0 {

if self.internalFromSide == .left {
self.openSide(.left) {
self.gestureLastPercentage = -1.0
}
} else if self.internalFromSide == .right {
self.openSide(.right) {
self.gestureLastPercentage = -1.0
}
}

} else {
self.closeSide {
self.gestureLastPercentage = -1.0
}
}
}

Expand Down
10 changes: 5 additions & 5 deletions DrawerController/Transition/DrawerFoldTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class DrawerFoldTransition: DrawerTransition {
)
)
foldView.layer.anchorPoint = CGPoint(x: Double(i % 2), y: 0.5)
foldView.layer.transform = CATransform3DMakeRotation(CGFloat(M_PI_2), 0, 1, 0)
foldView.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi / 2), 0, 1, 0)

if i == 0 {
foldView.shadowLayer.colors = [UIColor(white: 0.0, alpha: 0.05).cgColor, UIColor(white: 0.0, alpha: 0.6).cgColor]
Expand Down Expand Up @@ -132,9 +132,9 @@ public class DrawerFoldTransition: DrawerTransition {
case .left:
let sidePercent = 1.0 + percentage

self.foldList[0].layer.transform = CATransform3DMakeRotation(CGFloat(M_PI_2 - asin(Double(sidePercent))), 0, 1, 0)
self.foldList[0].layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi / 2 - asin(Double(sidePercent))), 0, 1, 0)
self.foldList[1].layer.transform = CATransform3DConcat(
CATransform3DMakeRotation(CGFloat(M_PI_2 - asin(Double(sidePercent))), 0, -1, 0),
CATransform3DMakeRotation(CGFloat(Double.pi / 2 - asin(Double(sidePercent))), 0, -1, 0),
CATransform3DMakeTranslation(self.foldList[0].frame.width * 2, 0, 0)
)

Expand Down Expand Up @@ -162,9 +162,9 @@ public class DrawerFoldTransition: DrawerTransition {
height: content.contentView.frame.height
)

self.foldList[0].layer.transform = CATransform3DMakeRotation(CGFloat(M_PI_2 - asin(Double(sidePercent))), 0, 1, 0)
self.foldList[0].layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi / 2 - asin(Double(sidePercent))), 0, 1, 0)
self.foldList[1].layer.transform = CATransform3DConcat(
CATransform3DMakeRotation(CGFloat(M_PI_2 - asin(Double(sidePercent))), 0, -1, 0),
CATransform3DMakeRotation(CGFloat(Double.pi / 2 - asin(Double(sidePercent))), 0, -1, 0),
CATransform3DMakeTranslation(self.foldList[0].frame.width * 2, 0, 0)
)

Expand Down
24 changes: 5 additions & 19 deletions Example/KWDrawerController-Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
9D2D4C421E4F722100E2B7A7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D2D4C3F1E4F722100E2B7A7 /* AppDelegate.swift */; };
9D2D4C431E4F722100E2B7A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9D2D4C401E4F722100E2B7A7 /* Info.plist */; };
9D2D4C441E4F722100E2B7A7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9D2D4C411E4F722100E2B7A7 /* Main.storyboard */; };
9D2D4C471E4F723100E2B7A7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9D2D4C451E4F723100E2B7A7 /* LaunchScreen.storyboard */; };
9D2D4C491E4F723900E2B7A7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9D2D4C481E4F723900E2B7A7 /* Assets.xcassets */; };
Expand Down Expand Up @@ -277,12 +276,11 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0830;
ORGANIZATIONNAME = Kawoou;
TargetAttributes = {
9D2D4C291E4F71CF00E2B7A7 = {
CreatedOnToolsVersion = 8.2;
DevelopmentTeam = 4U2J29Y5X8;
LastSwiftMigration = 0820;
ProvisioningStyle = Automatic;
};
Expand Down Expand Up @@ -312,7 +310,6 @@
buildActionMask = 2147483647;
files = (
9D2D4C471E4F723100E2B7A7 /* LaunchScreen.storyboard in Resources */,
9D2D4C431E4F722100E2B7A7 /* Info.plist in Resources */,
9D2D4C491E4F723900E2B7A7 /* Assets.xcassets in Resources */,
9D2D4C441E4F722100E2B7A7 /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -405,13 +402,9 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -424,13 +417,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
Expand All @@ -455,24 +447,20 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -482,11 +470,10 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 4U2J29Y5X8;
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kawoou.library.drawer.KWDrawerController-Example";
PRODUCT_BUNDLE_IDENTIFIER = com.kawoou.library.drawer.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
Expand All @@ -498,11 +485,10 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 4U2J29Y5X8;
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kawoou.library.drawer.KWDrawerController-Example";
PRODUCT_BUNDLE_IDENTIFIER = com.kawoou.library.drawer.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion KWDrawerController.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "KWDrawerController"
s.version = "3.3"
s.version = "3.4"
s.summary = "Drawer view controller that easy to use!"
s.license = { :type => "MIT", :file => "LICENSE" }
s.homepage = "https://github.com/Kawoou/KWDrawerController"
Expand Down
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
KWDrawerController
==================

[![Pod Version](http://img.shields.io/cocoapods/v/KWDrawerController.svg?style=flat)](http://cocoadocs.org/docsets/KWDrawerController/3.3)
[![Pod Platform](http://img.shields.io/cocoapods/p/KWDrawerController.svg?style=flat)](http://cocoadocs.org/docsets/KWDrawerController/3.3)
[![Pod Version](http://img.shields.io/cocoapods/v/KWDrawerController.svg?style=flat)](http://cocoadocs.org/docsets/KWDrawerController/3.4)
[![Pod Platform](http://img.shields.io/cocoapods/p/KWDrawerController.svg?style=flat)](http://cocoadocs.org/docsets/KWDrawerController/3.4)
[![Pod License](http://img.shields.io/cocoapods/l/KWDrawerController.svg?style=flat)](https://github.com/kawoou/KWDrawerController/blob/master/LICENSE)
![Swift](https://img.shields.io/badge/Swift-3.0-orange.svg)

Expand All @@ -17,16 +17,7 @@ Installation
KWDrawerController is available on [CocoaPods](https://github.com/cocoapods/cocoapods). Add the following to your Podfile:

```ruby
pod 'KWDrawerController', '~> 3.3'
```


### CocoaSeeds (For iOS 7 projects)

I recommend you to try [CocoaSeeds](https://github.com/devxoul/CocoaSeeds), which uses source code instead of dynamic frameworks. Sample Seedfile:

```ruby
github 'kawoou/KWDrawerController', '3.3', :files => 'DrawerController/**.{swift}'
pod 'KWDrawerController', '~> 3.4'
```


Expand Down Expand Up @@ -235,6 +226,7 @@ Changelog
+ 3.1 Fix Access Control issues on DrawerController.
+ 3.2 Fix Access Control issues on Transition.
+ 3.3 Fix Access Control issues on initializer.
+ 3.4 Remove debug log.


⚠️ Requirements
Expand Down

0 comments on commit ae88053

Please sign in to comment.