Skip to content

Commit

Permalink
Merge pull request #5 from motokiee/swift3
Browse files Browse the repository at this point in the history
Change Swift3 syntax
  • Loading branch information
motokiee authored Dec 31, 2016
2 parents 7fe479a + eb47dbb commit ce764ac
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 48 deletions.
10 changes: 9 additions & 1 deletion Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0710;
LastUpgradeCheck = 0810;
ORGANIZATIONNAME = MotokiNarita;
TargetAttributes = {
363076411C297E0900D56CAD = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0810;
};
};
};
Expand Down Expand Up @@ -213,8 +214,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 @@ -257,8 +260,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 @@ -277,6 +282,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -290,6 +296,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.wearable44.Demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -302,6 +309,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.wearable44.Demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
12 changes: 6 additions & 6 deletions Demo/Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


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

func applicationWillResignActive(application: UIApplication) {
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) {
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) {
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) {
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) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

Expand Down
8 changes: 4 additions & 4 deletions Demo/Demo/OriginalCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ class OriginalCell: UITableViewCell {

typealias CellInfo = (color: UIColor, clipsToBouds: Bool)

func configure(info: CellInfo) {
func configure(_ info: CellInfo) {

configuration = UIView.RippleConfiguration(color: info.color)
configuration.clipsToBounds = info.clipsToBouds

clipsToBounds = configuration.clipsToBounds
selectionStyle = .None
selectionStyle = .none
}

override func setSelected(selected: Bool, animated: Bool) {
override func setSelected(_ selected: Bool, animated: Bool) {

super.setSelected(selected, animated: animated)

Expand All @@ -35,7 +35,7 @@ class OriginalCell: UITableViewCell {
let startRect = CGRect(x: self.frame.width/2 - rippleStartSize.width/2, y: self.frame.height/2 - rippleStartSize.height/2, width: rippleStartSize.width, height: rippleStartSize.height)
configuration.startRect = startRect

contentView.rippleAnimate(configuration, completionHandler: { print("ripple!!") })
contentView.rippleAnimate(with: configuration, completionHandler: { print("ripple!!") })
}
}
}
18 changes: 9 additions & 9 deletions Demo/Demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class ViewController: UIViewController {
}

// MARK: Action
@IBAction func tapped(sender: UIButton) {
@IBAction func tapped(_ sender: UIButton) {
// !!!: example for ripple animation for UIView
let config = UIView.RippleConfiguration(color: UIColor.alizarin())
sender.rippleAnimate(config, completionHandler: {
sender.rippleAnimate(with: config, completionHandler: {
print("ripple!!")
})
}
Expand All @@ -44,17 +44,17 @@ class ViewController: UIViewController {
extension ViewController: UITableViewDataSource, UITableViewDelegate {

// MARK: UITableViewDataSource
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return colors.count
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

guard let cell = tableView.dequeueReusableCellWithIdentifier("Cell") as? OriginalCell else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as? OriginalCell else {
fatalError()
}
cell.configure(colors[indexPath.row])
Expand All @@ -63,11 +63,11 @@ extension ViewController: UITableViewDataSource, UITableViewDelegate {


// MARK: UITableViewDelegate
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: false)
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: false)
}

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ And now, you can call `rippleAnimate` with `UIView.RippleConfiguration` instance
```
@IBAction func pressed(sender: UIButton) {
let config = UIView.RippleConfiguration(color: UIColor.alizarin())
sender.rippleAnimate(config, completionHandler: {
sender.rippleAnimate(with: config, completionHandler: {
print("ripple!!")
})
}
Expand All @@ -38,7 +38,7 @@ You can use `rippleAnimate` with more detail parameters with `RippleConfiguratio
config.clipsToBounds = true
config.scaleAnimateDuration = 0.3
config.fadeAnimateDuration = 0.1
sender.rippleAnimate(config, completionHandler: {
sender.rippleAnimate(with: config, completionHandler: {
print("ripple!!")
})
}
Expand All @@ -49,8 +49,8 @@ More details is written in Demo project.

## Runtime Requirements

- iOS8.4 or later
- Xcode 7.0 - Swift2.0
- iOS9.3 or later
- Xcode8 - Swift3

### Installation

Expand All @@ -61,9 +61,9 @@ To install RippleAnimation with CocoaPods, add the following lines in your Podfi
```
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
platform :ios, '9.0'
use_frameworks!
pod ‘RippleAnimation’, ‘0.1.1
pod ‘RippleAnimation’, ‘0.3
```

#### Carthage
Expand Down
16 changes: 13 additions & 3 deletions RippleAnimation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@
363076251C297DEE00D56CAD /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0710;
LastUpgradeCheck = 0810;
ORGANIZATIONNAME = MotokiNarita;
TargetAttributes = {
3630762D1C297DEE00D56CAD = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0810;
};
};
};
Expand Down Expand Up @@ -153,8 +154,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 @@ -177,7 +180,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -201,8 +204,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 @@ -219,9 +224,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -233,6 +239,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -244,13 +251,15 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
363076381C297DEE00D56CAD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -261,6 +270,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.wearable44.RippleAnimation;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
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 = "0710"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Loading

0 comments on commit ce764ac

Please sign in to comment.