Skip to content

Commit

Permalink
Merge pull request #12 from codeOfRobin/master
Browse files Browse the repository at this point in the history
Added support for Swift 4.2
  • Loading branch information
mergesort committed Dec 30, 2018
2 parents bdecf36 + b6ed54d commit 525ce56
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 17 deletions.
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

# 1.3 (2018-12-31)

- Added support for Swift 4.2.

# 1.2 (2017-09-27)

- `animateTableView()` and `animateCells()` have been renamed to `animate()` and are differentiated based on the parameter passed in.
Expand Down
11 changes: 8 additions & 3 deletions Example/TableFlipExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0900;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = Mergesort;
TargetAttributes = {
B7D7EEFF1F532EEB00FA580C = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 1010;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -194,13 +195,15 @@
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_DOCUMENTATION_COMMENTS = YES;
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 @@ -251,13 +254,15 @@
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_DOCUMENTATION_COMMENTS = YES;
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 @@ -296,7 +301,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.example.TableFlipExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -310,7 +315,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.example.TableFlipExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,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>
2 changes: 1 addition & 1 deletion Example/TableFlipExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
2 changes: 1 addition & 1 deletion Example/TableFlipExample/TableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private extension TableViewController {
self.tableView.animate(animation: customAnimation, completion: nil)

case .indexPaths:
let evenIndices = (0..<self.dataSource.exampleItems.count).flatMap { return ($0 % 2 == 0) ? IndexPath(row: $0, section: 0) : nil }
let evenIndices = (0..<self.dataSource.exampleItems.count).compactMap { return ($0 % 2 == 0) ? IndexPath(row: $0, section: 0) : nil }
let rightAnimation = TableViewAnimation.Cell.right(duration: 0.5)
self.tableView.animate(animation: rightAnimation, indexPaths: evenIndices, completion: nil)

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
---

[![Pod Version](https://img.shields.io/badge/Pod-1.1-6193DF.svg)](https://cocoapods.org/)
![Swift Version](https://img.shields.io/badge/Swift-3.0%20|%203.1%20|%203.2%20|%204.0-brightgreen.svg)
![Swift Version](https://img.shields.io/badge/Swift-4.2-brightgreen.svg)
![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg)
![Plaform](https://img.shields.io/badge/Platform-iOS-lightgrey.svg)

Expand Down Expand Up @@ -81,7 +81,8 @@ self.tableView.animate(animation: customAnimation, completion: nil)
## Requirements

- iOS 8.0+
- Xcode 7.3+
- Xcode 10.0+
- Swift 4.2

## Installation
You can use [CocoaPods](http://cocoapods.org/) to install `TableFlip` by adding it to your `Podfile`:
Expand Down
14 changes: 7 additions & 7 deletions Source/UITableView+TableFlip.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public enum TableViewAnimation {
case top(duration: TimeInterval)
case bottom(duration: TimeInterval)
case fade(duration: TimeInterval)
case custom(duration: TimeInterval, transform: CGAffineTransform, options: UIViewAnimationOptions)
case custom(duration: TimeInterval, transform: CGAffineTransform, options: UIView.AnimationOptions)

fileprivate enum AnimationDirection {

Expand Down Expand Up @@ -50,7 +50,7 @@ public enum TableViewAnimation {
case left(duration: TimeInterval)
case right(duration: TimeInterval)
case fade(duration: TimeInterval)
case custom(duration: TimeInterval, transform: CGAffineTransform, options: UIViewAnimationOptions)
case custom(duration: TimeInterval, transform: CGAffineTransform, options: UIView.AnimationOptions)

fileprivate enum AnimationDirection {

Expand Down Expand Up @@ -156,7 +156,7 @@ public extension UITableView {

fileprivate extension UITableView {

func animateTableViewWithTransform(duration: TimeInterval, transform: CGAffineTransform, options: UIViewAnimationOptions = .curveEaseInOut, completion: (() -> Void)? = nil) {
func animateTableViewWithTransform(duration: TimeInterval, transform: CGAffineTransform, options: UIView.AnimationOptions = .curveEaseInOut, completion: (() -> Void)? = nil) {
self.layer.setAffineTransform(transform)

UIView.animate(withDuration: duration, delay: 0.0, usingSpringWithDamping: 0.75, initialSpringVelocity: 0.0, options: options, animations: {
Expand Down Expand Up @@ -213,7 +213,7 @@ fileprivate extension UITableView {
}
}

func animateTableCellsWithTransform(duration: TimeInterval, transform: CGAffineTransform, options: UIViewAnimationOptions = .curveEaseInOut, completion: (() -> Void)? = nil) {
func animateTableCellsWithTransform(duration: TimeInterval, transform: CGAffineTransform, options: UIView.AnimationOptions = .curveEaseInOut, completion: (() -> Void)? = nil) {
for (index, cell) in self.visibleCells.enumerated() {
let delay: TimeInterval = duration/Double(self.visibleCells.count)*Double(index)
let damping: CGFloat = 0.55
Expand Down Expand Up @@ -254,9 +254,9 @@ fileprivate extension UITableView {
} else {
func fadeAnimationTransition() -> CATransition {
let animation = CATransition()
animation.type = kCATransitionFade
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
animation.fillMode = kCAFillModeBoth
animation.type = CATransitionType.fade
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
animation.fillMode = CAMediaTimingFillMode.both

return animation
}
Expand Down
4 changes: 2 additions & 2 deletions TableFlip.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'TableFlip'
spec.version = '1.2'
spec.version = '1.3'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.homepage = 'https://github.com/mergesort/TableFlip'
spec.authors = { 'Joe Fabisevich' => 'github@fabisevi.ch' }
Expand All @@ -11,5 +11,5 @@ Pod::Spec.new do |spec|
spec.requires_arc = true
spec.social_media_url = 'https://twitter.com/mergesort'
spec.ios.deployment_target = '8.0'

spec.swift_version = '4.2'
end

0 comments on commit 525ce56

Please sign in to comment.