Skip to content

Commit

Permalink
Merge branch 'swift-3'
Browse files Browse the repository at this point in the history
  • Loading branch information
serejahh committed Dec 22, 2016
2 parents 5a12181 + 00fc639 commit cc79d3e
Show file tree
Hide file tree
Showing 27 changed files with 760 additions and 685 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "facebook/pop"
github "facebook/pop" ~> 1.0
32 changes: 21 additions & 11 deletions Example/Koloda.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Koloda_Example" */;
buildPhases = (
0182469EE898CFC3334C577B /* Check Pods Manifest.lock */,
0182469EE898CFC3334C577B /* [CP] Check Pods Manifest.lock */,
607FACCC1AFB9204008FA782 /* Sources */,
607FACCD1AFB9204008FA782 /* Frameworks */,
607FACCE1AFB9204008FA782 /* Resources */,
64922D3147424C142700ED20 /* Embed Pods Frameworks */,
822E414921E8C1E4C57072A9 /* Copy Pods Resources */,
64922D3147424C142700ED20 /* [CP] Embed Pods Frameworks */,
822E414921E8C1E4C57072A9 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -166,11 +166,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -208,44 +209,44 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
0182469EE898CFC3334C577B /* Check Pods Manifest.lock */ = {
0182469EE898CFC3334C577B /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
64922D3147424C142700ED20 /* Embed Pods Frameworks */ = {
64922D3147424C142700ED20 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Koloda_Example/Pods-Koloda_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
822E414921E8C1E4C57072A9 /* Copy Pods Resources */ = {
822E414921E8C1E4C57072A9 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -313,8 +314,10 @@
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_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -358,8 +361,10 @@
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_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -378,6 +383,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -386,27 +392,31 @@
isa = XCBuildConfiguration;
baseConfigurationReference = CF2C9E50C19A9188464AE19E /* Pods-Koloda_Example.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = Koloda/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "com.yalantis.Koloda-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
607FACF11AFB9204008FA782 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 093C6CC368001B8BAFD235CB /* Pods-Koloda_Example.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = Koloda/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "com.yalantis.Koloda-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
31 changes: 0 additions & 31 deletions Example/Koloda/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,4 @@ import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

35 changes: 17 additions & 18 deletions Example/Koloda/BackgroundAnimationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import Koloda
import pop

private let numberOfCards: UInt = 5
private let numberOfCards: Int = 5
private let frameAnimationSpringBounciness: CGFloat = 9
private let frameAnimationSpringSpeed: CGFloat = 16
private let kolodaCountOfVisibleCards = 2
Expand All @@ -29,17 +29,17 @@ class BackgroundAnimationViewController: UIViewController {
kolodaView.dataSource = self
kolodaView.animator = BackgroundKolodaAnimator(koloda: kolodaView)

self.modalTransitionStyle = UIModalTransitionStyle.FlipHorizontal
self.modalTransitionStyle = UIModalTransitionStyle.flipHorizontal
}


//MARK: IBActions
@IBAction func leftButtonTapped() {
kolodaView?.swipe(SwipeResultDirection.Left)
kolodaView?.swipe(.left)
}

@IBAction func rightButtonTapped() {
kolodaView?.swipe(SwipeResultDirection.Right)
kolodaView?.swipe(.right)
}

@IBAction func undoButtonTapped() {
Expand All @@ -50,47 +50,46 @@ class BackgroundAnimationViewController: UIViewController {
//MARK: KolodaViewDelegate
extension BackgroundAnimationViewController: KolodaViewDelegate {

func kolodaDidRunOutOfCards(koloda: KolodaView) {
func kolodaDidRunOutOfCards(_ koloda: KolodaView) {
kolodaView.resetCurrentCardIndex()
}

func koloda(koloda: KolodaView, didSelectCardAtIndex index: UInt) {
UIApplication.sharedApplication().openURL(NSURL(string: "http://yalantis.com/")!)
func koloda(_ koloda: KolodaView, didSelectCardAt index: Int) {
UIApplication.shared.openURL(URL(string: "https://yalantis.com/")!)
}

func kolodaShouldApplyAppearAnimation(koloda: KolodaView) -> Bool {
func kolodaShouldApplyAppearAnimation(_ koloda: KolodaView) -> Bool {
return true
}

func kolodaShouldMoveBackgroundCard(koloda: KolodaView) -> Bool {
func kolodaShouldMoveBackgroundCard(_ koloda: KolodaView) -> Bool {
return false
}

func kolodaShouldTransparentizeNextCard(koloda: KolodaView) -> Bool {
func kolodaShouldTransparentizeNextCard(_ koloda: KolodaView) -> Bool {
return true
}

func koloda(kolodaBackgroundCardAnimation koloda: KolodaView) -> POPPropertyAnimation? {
let animation = POPSpringAnimation(propertyNamed: kPOPViewFrame)
animation.springBounciness = frameAnimationSpringBounciness
animation.springSpeed = frameAnimationSpringSpeed
animation?.springBounciness = frameAnimationSpringBounciness
animation?.springSpeed = frameAnimationSpringSpeed
return animation
}
}

//MARK: KolodaViewDataSource
// MARK: KolodaViewDataSource
extension BackgroundAnimationViewController: KolodaViewDataSource {

func kolodaNumberOfCards(koloda: KolodaView) -> UInt {
func kolodaNumberOfCards(_ koloda: KolodaView) -> Int {
return numberOfCards
}

func koloda(koloda: KolodaView, viewForCardAtIndex index: UInt) -> UIView {
func koloda(_ koloda: KolodaView, viewForCardAt index: Int) -> UIView {
return UIImageView(image: UIImage(named: "cards_\(index + 1)"))
}

func koloda(koloda: KolodaView, viewForCardOverlayAtIndex index: UInt) -> OverlayView? {
return NSBundle.mainBundle().loadNibNamed("CustomOverlayView",
owner: self, options: nil)[0] as? OverlayView
func koloda(_ koloda: KolodaView, viewForCardOverlayAt index: Int) -> OverlayView? {
return Bundle.main.loadNibNamed("CustomOverlayView", owner: self, options: nil)?[0] as? OverlayView
}
}
22 changes: 11 additions & 11 deletions Example/Koloda/BackgroundKolodaAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ import pop

class BackgroundKolodaAnimator: KolodaViewAnimator {

override func applyScaleAnimation(card: DraggableCardView, scale: CGSize, frame: CGRect, duration: NSTimeInterval, completion: AnimationCompletionBlock) {
override func applyScaleAnimation(_ card: DraggableCardView, scale: CGSize, frame: CGRect, duration: TimeInterval, completion: AnimationCompletionBlock) {

let scaleAnimation = POPSpringAnimation(propertyNamed: kPOPLayerScaleXY)
scaleAnimation.springBounciness = 9
scaleAnimation.springSpeed = 16
scaleAnimation.toValue = NSValue(CGSize: scale)
card.layer.pop_addAnimation(scaleAnimation, forKey: "scaleAnimation")
scaleAnimation?.springBounciness = 9
scaleAnimation?.springSpeed = 16
scaleAnimation?.toValue = NSValue(cgSize: scale)
card.layer.pop_add(scaleAnimation, forKey: "scaleAnimation")

let frameAnimation = POPSpringAnimation(propertyNamed: kPOPViewFrame)
frameAnimation.springBounciness = 9
frameAnimation.springSpeed = 16
frameAnimation.toValue = NSValue(CGRect: frame)
frameAnimation?.springBounciness = 9
frameAnimation?.springSpeed = 16
frameAnimation?.toValue = NSValue(cgRect: frame)
if let completion = completion {
frameAnimation.completionBlock = { _, finished in
frameAnimation?.completionBlock = { _, finished in
completion(finished)
}
}
card.pop_addAnimation(frameAnimation, forKey: "frameAnimation")
card.pop_add(frameAnimation, forKey: "frameAnimation")
}

}
}
13 changes: 9 additions & 4 deletions Example/Koloda/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
Expand All @@ -24,7 +29,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
Expand Down
Loading

0 comments on commit cc79d3e

Please sign in to comment.