Skip to content

Commit c0604d3

Browse files
authored
Merge pull request #37 from jcavar/swift4
Swift 4
2 parents 44534b4 + 824a713 commit c0604d3

File tree

14 files changed

+92
-142
lines changed

14 files changed

+92
-142
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0
1+
4.0

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
language: objective-c
2-
osx_image: xcode8
3-
script: xcodebuild test -scheme Refresher -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3'
1+
language: swift
2+
osx_image: xcode9
3+
script: xcodebuild test -scheme Refresher -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.0'

PullToRefresh.xcodeproj/project.pbxproj

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,21 +296,21 @@
296296
isa = PBXProject;
297297
attributes = {
298298
LastSwiftUpdateCheck = 0700;
299-
LastUpgradeCheck = 0800;
299+
LastUpgradeCheck = 0900;
300300
ORGANIZATIONNAME = "Josip Cavar";
301301
TargetAttributes = {
302302
C7AC6CCB19A7FE6D007107DF = {
303303
CreatedOnToolsVersion = 6.0;
304-
LastSwiftMigration = 0800;
304+
LastSwiftMigration = 0900;
305305
};
306306
C7AC6CD519A7FE6D007107DF = {
307307
CreatedOnToolsVersion = 6.0;
308-
LastSwiftMigration = 0800;
308+
LastSwiftMigration = 0900;
309309
TestTargetID = C7D1CF8E199BB3C8009FD485;
310310
};
311311
C7D1CF8E199BB3C8009FD485 = {
312312
CreatedOnToolsVersion = 6.0;
313-
LastSwiftMigration = 0800;
313+
LastSwiftMigration = 0900;
314314
};
315315
};
316316
};
@@ -451,7 +451,7 @@
451451
PRODUCT_NAME = "$(TARGET_NAME)";
452452
SKIP_INSTALL = YES;
453453
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
454-
SWIFT_VERSION = 3.0;
454+
SWIFT_VERSION = 4.0;
455455
VERSIONING_SYSTEM = "apple-generic";
456456
VERSION_INFO_PREFIX = "";
457457
};
@@ -473,7 +473,7 @@
473473
PRODUCT_BUNDLE_IDENTIFIER = "JCA.$(PRODUCT_NAME:rfc1034identifier)";
474474
PRODUCT_NAME = "$(TARGET_NAME)";
475475
SKIP_INSTALL = YES;
476-
SWIFT_VERSION = 3.0;
476+
SWIFT_VERSION = 4.0;
477477
VERSIONING_SYSTEM = "apple-generic";
478478
VERSION_INFO_PREFIX = "";
479479
};
@@ -494,7 +494,7 @@
494494
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
495495
PRODUCT_BUNDLE_IDENTIFIER = "JCA.$(PRODUCT_NAME:rfc1034identifier)";
496496
PRODUCT_NAME = "$(TARGET_NAME)";
497-
SWIFT_VERSION = 3.0;
497+
SWIFT_VERSION = 4.0;
498498
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PullToRefreshDemo.app/PullToRefreshDemo";
499499
};
500500
name = Debug;
@@ -510,7 +510,7 @@
510510
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
511511
PRODUCT_BUNDLE_IDENTIFIER = "JCA.$(PRODUCT_NAME:rfc1034identifier)";
512512
PRODUCT_NAME = "$(TARGET_NAME)";
513-
SWIFT_VERSION = 3.0;
513+
SWIFT_VERSION = 4.0;
514514
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PullToRefreshDemo.app/PullToRefreshDemo";
515515
};
516516
name = Release;
@@ -523,14 +523,20 @@
523523
CLANG_CXX_LIBRARY = "libc++";
524524
CLANG_ENABLE_MODULES = YES;
525525
CLANG_ENABLE_OBJC_ARC = YES;
526+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
526527
CLANG_WARN_BOOL_CONVERSION = YES;
528+
CLANG_WARN_COMMA = YES;
527529
CLANG_WARN_CONSTANT_CONVERSION = YES;
528530
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
529531
CLANG_WARN_EMPTY_BODY = YES;
530532
CLANG_WARN_ENUM_CONVERSION = YES;
531533
CLANG_WARN_INFINITE_RECURSION = YES;
532534
CLANG_WARN_INT_CONVERSION = YES;
535+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
536+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
533537
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
538+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
539+
CLANG_WARN_STRICT_PROTOTYPES = YES;
534540
CLANG_WARN_SUSPICIOUS_MOVE = YES;
535541
CLANG_WARN_UNREACHABLE_CODE = YES;
536542
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -570,14 +576,20 @@
570576
CLANG_CXX_LIBRARY = "libc++";
571577
CLANG_ENABLE_MODULES = YES;
572578
CLANG_ENABLE_OBJC_ARC = YES;
579+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
573580
CLANG_WARN_BOOL_CONVERSION = YES;
581+
CLANG_WARN_COMMA = YES;
574582
CLANG_WARN_CONSTANT_CONVERSION = YES;
575583
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
576584
CLANG_WARN_EMPTY_BODY = YES;
577585
CLANG_WARN_ENUM_CONVERSION = YES;
578586
CLANG_WARN_INFINITE_RECURSION = YES;
579587
CLANG_WARN_INT_CONVERSION = YES;
588+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
589+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
580590
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
591+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
592+
CLANG_WARN_STRICT_PROTOTYPES = YES;
581593
CLANG_WARN_SUSPICIOUS_MOVE = YES;
582594
CLANG_WARN_UNREACHABLE_CODE = YES;
583595
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -612,7 +624,7 @@
612624
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
613625
PRODUCT_BUNDLE_IDENTIFIER = "JCA.${PRODUCT_NAME:rfc1034identifier}";
614626
PRODUCT_NAME = "$(TARGET_NAME)";
615-
SWIFT_VERSION = 3.0;
627+
SWIFT_VERSION = 4.0;
616628
};
617629
name = Debug;
618630
};
@@ -626,7 +638,7 @@
626638
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
627639
PRODUCT_BUNDLE_IDENTIFIER = "JCA.${PRODUCT_NAME:rfc1034identifier}";
628640
PRODUCT_NAME = "$(TARGET_NAME)";
629-
SWIFT_VERSION = 3.0;
641+
SWIFT_VERSION = 4.0;
630642
};
631643
name = Release;
632644
};

PullToRefresh.xcodeproj/xcshareddata/xcschemes/PullToRefresh.xcscheme

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
<TestableReference
@@ -55,6 +56,7 @@
5556
buildConfiguration = "Debug"
5657
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5758
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59+
language = ""
5860
launchStyle = "0"
5961
useCustomWorkingDirectory = "NO"
6062
ignoresPersistentStateOnLaunch = "NO"

PullToRefresh.xcodeproj/xcshareddata/xcschemes/Refresher.xcscheme

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -40,6 +40,7 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
language = ""
4344
shouldUseLaunchSchemeArgsEnv = "YES">
4445
<Testables>
4546
<TestableReference
@@ -69,6 +70,7 @@
6970
buildConfiguration = "Debug"
7071
selectedDebuggerIdentifier = ""
7172
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
73+
language = ""
7274
launchStyle = "0"
7375
useCustomWorkingDirectory = "NO"
7476
ignoresPersistentStateOnLaunch = "NO"

PullToRefreshDemo/PacmanAnimator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class PacmanAnimator: UIView, PullToRefreshViewDelegate {
8888
superview.layer.addSublayer(layerLoader)
8989
}
9090
let center = CGPoint(x: 30, y: superview.frame.size.height / 2)
91-
let bezierPathLoader = UIBezierPath(arcCenter: center, radius: CGFloat(10), startAngle: CGFloat(0), endAngle: CGFloat(2 * M_PI), clockwise: true)
91+
let bezierPathLoader = UIBezierPath(arcCenter: center, radius: CGFloat(10), startAngle: CGFloat(0), endAngle: CGFloat(2 * Double.pi), clockwise: true)
9292
let bezierPathSeparator = UIBezierPath()
9393
bezierPathSeparator.move(to: CGPoint(x: 0, y: superview.frame.height - 1))
9494
bezierPathSeparator.addLine(to: CGPoint(x: superview.frame.width, y: superview.frame.height - 1))

PullToRefreshDemo/PullToRefreshViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ class PullToRefreshViewController: UIViewController {
9393
// Dispose of any resources that can be recreated.
9494
}
9595

96-
func tableView(_ tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
96+
@objc func tableView(_ tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
9797
return 50
9898
}
9999

100-
func tableView(_ tableView: UITableView!, cellForRowAtIndexPath indexPath: IndexPath!) -> UITableViewCell! {
100+
@objc func tableView(_ tableView: UITableView!, cellForRowAtIndexPath indexPath: IndexPath!) -> UITableViewCell! {
101101
let cell = UITableViewCell(style: .default, reuseIdentifier: "Cell")
102102
cell.textLabel?.text = "Row " + String(indexPath.row + 1)
103103
return cell

Refresher.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'Refresher'
4-
s.version = '0.6.1'
4+
s.version = '0.7.0'
55
s.summary = 'Pull to refresh in Swift'
66

77
s.description = <<-DESC

Refresher/Animator.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ import QuartzCore
2626
import UIKit
2727

2828
internal class AnimatorView: UIView {
29-
3029
fileprivate let titleLabel: UILabel = {
3130
let label = UILabel()
3231
label.translatesAutoresizingMaskIntoConstraints = false
3332
return label
3433
}()
35-
3634
fileprivate let activityIndicatorView: UIActivityIndicatorView = {
3735
let activity = UIActivityIndicatorView(activityIndicatorStyle: .gray)
3836
activity.translatesAutoresizingMaskIntoConstraints = false
@@ -60,7 +58,6 @@ internal class AnimatorView: UIView {
6058
}
6159

6260
class Animator: PullToRefreshViewDelegate {
63-
6461
internal let animatorView: AnimatorView
6562

6663
init(frame: CGRect) {

Refresher/PullToRefreshExtension.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ extension UIScrollView {
3838
}
3939

4040
// If you want to add pull to refresh functionality to your UIScrollView just call this method and pass action closure you want to execute while pull to refresh is animating. If you want to stop pull to refresh you must do that manually calling stopPullToRefreshView methods on your scroll view
41-
public func addPullToRefreshWithAction(_ action:@escaping (() -> ())) {
41+
public func addPullToRefreshWithAction(_ action: @escaping (() -> ())) {
4242
let pullToRefreshView = PullToRefreshView(action: action, frame: CGRect(x: 0, y: -pullToRefreshDefaultHeight, width: self.frame.size.width, height: pullToRefreshDefaultHeight))
4343
pullToRefreshView.tag = pullToRefreshTag
4444
addSubview(pullToRefreshView)
4545
}
4646

4747
// If you want to use your custom animation and custom subview when pull to refresh is animating, you should call this method and pass your animator and view objects.
48-
public func addPullToRefreshWithAction(_ action:@escaping (() -> ()), withAnimator animator: PullToRefreshViewDelegate, withSubview subview: UIView) {
48+
public func addPullToRefreshWithAction(_ action: @escaping (() -> ()), withAnimator animator: PullToRefreshViewDelegate, withSubview subview: UIView) {
4949
let height = subview.frame.height
5050
let pullToRefreshView = PullToRefreshView(action: action, frame: CGRect(x: 0, y: -height, width: self.frame.size.width, height: height), animator: animator, subview: subview)
5151
pullToRefreshView.tag = pullToRefreshTag
5252
addSubview(pullToRefreshView)
5353
}
5454

5555
//
56-
public func addPullToRefreshWithAction<T: UIView>(_ action:@escaping (() -> ()), withAnimator animator: T) where T: PullToRefreshViewDelegate {
56+
public func addPullToRefreshWithAction<T: UIView>(_ action: @escaping (() -> ()), withAnimator animator: T) where T: PullToRefreshViewDelegate {
5757
let height = animator.frame.height
5858
let pullToRefreshView = PullToRefreshView(action: action, frame: CGRect(x: 0, y: -height, width: self.frame.size.width, height: height), animator: animator, subview: animator)
5959
pullToRefreshView.tag = pullToRefreshTag

0 commit comments

Comments
 (0)