diff --git a/.swift-version b/.swift-version
new file mode 100755
index 0000000..9f55b2c
--- /dev/null
+++ b/.swift-version
@@ -0,0 +1 @@
+3.0
diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj
index 0a879aa..9fb1029 100644
--- a/Example/Pods/Pods.xcodeproj/project.pbxproj
+++ b/Example/Pods/Pods.xcodeproj/project.pbxproj
@@ -356,6 +356,11 @@
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
+ TargetAttributes = {
+ CFCFF584725D9627FF22ABC53529F964 = {
+ LastSwiftMigration = 0800;
+ };
+ };
};
buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */;
compatibilityVersion = "Xcode 3.2";
@@ -481,6 +486,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
STRIP_INSTALLED_PRODUCT = NO;
+ SWIFT_VERSION = 3.0;
SYMROOT = "${SRCROOT}/../build";
VALIDATE_PRODUCT = YES;
};
@@ -563,6 +569,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
ONLY_ACTIVE_ARCH = YES;
STRIP_INSTALLED_PRODUCT = NO;
+ SWIFT_VERSION = 3.0;
SYMROOT = "${SRCROOT}/../build";
};
name = Debug;
@@ -588,6 +595,7 @@
PRODUCT_NAME = SWActivityIndicatorView;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
+ SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -658,6 +666,7 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
diff --git a/Example/Pods/Target Support Files/Pods-SWActivityIndicatorView Example/Info.plist b/Example/Pods/Target Support Files/Pods-SWActivityIndicatorView Example/Info.plist
index 6974542..8abce07 100644
--- a/Example/Pods/Target Support Files/Pods-SWActivityIndicatorView Example/Info.plist
+++ b/Example/Pods/Target Support Files/Pods-SWActivityIndicatorView Example/Info.plist
@@ -2,25 +2,25 @@
- CFBundleDevelopmentRegion
- en
- CFBundleExecutable
- ${EXECUTABLE_NAME}
- CFBundleIdentifier
- org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- ${PRODUCT_NAME}
- CFBundlePackageType
- FMWK
- CFBundleShortVersionString
- 1.0.0
- CFBundleSignature
- ????
- CFBundleVersion
- ${CURRENT_PROJECT_VERSION}
- NSPrincipalClass
-
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ ${EXECUTABLE_NAME}
+ CFBundleIdentifier
+ org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ ${PRODUCT_NAME}
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ 2.0.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ ${CURRENT_PROJECT_VERSION}
+ NSPrincipalClass
+
diff --git a/Example/Pods/Target Support Files/Pods-SWActivityIndicatorView Example_Tests/Info.plist b/Example/Pods/Target Support Files/Pods-SWActivityIndicatorView Example_Tests/Info.plist
index 6974542..8abce07 100644
--- a/Example/Pods/Target Support Files/Pods-SWActivityIndicatorView Example_Tests/Info.plist
+++ b/Example/Pods/Target Support Files/Pods-SWActivityIndicatorView Example_Tests/Info.plist
@@ -2,25 +2,25 @@
- CFBundleDevelopmentRegion
- en
- CFBundleExecutable
- ${EXECUTABLE_NAME}
- CFBundleIdentifier
- org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- ${PRODUCT_NAME}
- CFBundlePackageType
- FMWK
- CFBundleShortVersionString
- 1.0.0
- CFBundleSignature
- ????
- CFBundleVersion
- ${CURRENT_PROJECT_VERSION}
- NSPrincipalClass
-
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ ${EXECUTABLE_NAME}
+ CFBundleIdentifier
+ org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ ${PRODUCT_NAME}
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ 2.0.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ ${CURRENT_PROJECT_VERSION}
+ NSPrincipalClass
+
diff --git a/Pod/Classes/SWActivityIndicatorView.swift b/Pod/Classes/SWActivityIndicatorView.swift
index 9a4c226..d15358c 100644
--- a/Pod/Classes/SWActivityIndicatorView.swift
+++ b/Pod/Classes/SWActivityIndicatorView.swift
@@ -10,32 +10,32 @@ import UIKit
private let SWSpinningAnimationKey = "Rotation"
-@IBDesignable public class SWActivityIndicatorView: UIView {
- @IBInspectable public var lineWidth: CGFloat = 2 {
+@IBDesignable open class SWActivityIndicatorView: UIView {
+ @IBInspectable open var lineWidth: CGFloat = 2 {
didSet {
self.circlePathLayer.lineWidth = lineWidth
}
}
- private(set) public var isAnimating = false
- @IBInspectable public var autoStartAnimating: Bool = false {
+ fileprivate(set) open var isAnimating = false
+ @IBInspectable open var autoStartAnimating: Bool = false {
didSet {
if autoStartAnimating && self.superview != nil {
self.animate(true)
}
}
}
- @IBInspectable public var hidesWhenStopped: Bool = false {
+ @IBInspectable open var hidesWhenStopped: Bool = false {
didSet {
}
}
- @IBInspectable public var color: UIColor = UIColor.lightGrayColor() {
+ @IBInspectable open var color: UIColor = UIColor.lightGray {
didSet {
- self.circlePathLayer.strokeColor = color.CGColor
+ self.circlePathLayer.strokeColor = color.cgColor
}
}
- private var circlePathLayer = CAShapeLayer()
+ fileprivate var circlePathLayer = CAShapeLayer()
override public init(frame: CGRect) {
super.init(frame: frame)
@@ -47,14 +47,14 @@ private let SWSpinningAnimationKey = "Rotation"
configure()
}
- override public func layoutSubviews() {
+ override open func layoutSubviews() {
super.layoutSubviews()
self.circlePathLayer.frame = bounds
- self.circlePathLayer.path = self.circlePath().CGPath
+ self.circlePathLayer.path = self.circlePath().cgPath
}
- override public func willMoveToSuperview(newSuperview: UIView?) {
- super.willMoveToSuperview(newSuperview)
+ override open func willMove(toSuperview newSuperview: UIView?) {
+ super.willMove(toSuperview: newSuperview)
if newSuperview != nil {
if self.autoStartAnimating {
@@ -66,21 +66,21 @@ private let SWSpinningAnimationKey = "Rotation"
}
- public func startAnimating() {
+ open func startAnimating() {
self.animate(true)
}
- public func stopAnimating() {
+ open func stopAnimating() {
self.animate(false)
}
- private func animate(animated: Bool) {
+ fileprivate func animate(_ animated: Bool) {
if animated {
- self.hidden = false
+ self.isHidden = false
if self.isAnimating == false {
// create or resume
- if self.circlePathLayer.animationForKey(SWSpinningAnimationKey) == nil {
+ if self.circlePathLayer.animation(forKey: SWSpinningAnimationKey) == nil {
self.createAnimationLayer(self.circlePathLayer)
} else {
self.resumeLayer(self.circlePathLayer)
@@ -92,64 +92,64 @@ private let SWSpinningAnimationKey = "Rotation"
self.isAnimating = false
self.pauseLayer(self.circlePathLayer)
if self.hidesWhenStopped {
- self.hidden = true
+ self.isHidden = true
}
}
}
- private func pauseLayer(layer: CALayer) {
- let pausedTime = layer.convertTime(CACurrentMediaTime(), fromLayer: nil)
+ fileprivate func pauseLayer(_ layer: CALayer) {
+ let pausedTime = layer.convertTime(CACurrentMediaTime(), from: nil)
layer.speed = 0
layer.timeOffset = pausedTime
}
- private func resumeLayer(layer: CALayer) {
+ fileprivate func resumeLayer(_ layer: CALayer) {
let pausedTime = layer.timeOffset
layer.speed = 1
layer.timeOffset = 0
layer.beginTime = 0
- let timeSincePaused = layer.convertTime(CACurrentMediaTime(), fromLayer: nil) - pausedTime
+ let timeSincePaused = layer.convertTime(CACurrentMediaTime(), from: nil) - pausedTime
layer.beginTime = timeSincePaused
}
- private func createAnimationLayer(layer: CALayer) {
+ fileprivate func createAnimationLayer(_ layer: CALayer) {
let animation = CABasicAnimation(keyPath: "transform.rotation.z")
- animation.fromValue = NSNumber(float: 0)
- animation.toValue = NSNumber(double: 2 * M_PI)
+ animation.fromValue = NSNumber(value: 0 as Float)
+ animation.toValue = NSNumber(value: 2 * M_PI as Double)
animation.duration = 0.9;
- animation.removedOnCompletion = false // prevent from getting remove when app enter background or view disappear
+ animation.isRemovedOnCompletion = false // prevent from getting remove when app enter background or view disappear
animation.repeatCount = Float.infinity
- layer.addAnimation(animation, forKey: SWSpinningAnimationKey)
+ layer.add(animation, forKey: SWSpinningAnimationKey)
}
- private func circleFrame() -> CGRect {
+ fileprivate func circleFrame() -> CGRect {
// Align center
let diameter = min(self.circlePathLayer.bounds.size.width, self.circlePathLayer.bounds.size.height)
var circleFrame = CGRect(x: 0, y: 0, width: diameter, height: diameter)
- circleFrame.origin.x = CGRectGetMidX(circlePathLayer.bounds) - CGRectGetMidX(circleFrame)
- circleFrame.origin.y = CGRectGetMidY(circlePathLayer.bounds) - CGRectGetMidY(circleFrame)
+ circleFrame.origin.x = circlePathLayer.bounds.midX - circleFrame.midX
+ circleFrame.origin.y = circlePathLayer.bounds.midY - circleFrame.midY
// offset lineWidth
let inset = self.circlePathLayer.lineWidth / 2
- circleFrame = CGRectInset(circleFrame, inset, inset)
+ circleFrame = circleFrame.insetBy(dx: inset, dy: inset)
return circleFrame
}
- private func circlePath() -> UIBezierPath {
- return UIBezierPath(ovalInRect: self.circleFrame())
+ fileprivate func circlePath() -> UIBezierPath {
+ return UIBezierPath(ovalIn: self.circleFrame())
}
- private func configure() {
+ fileprivate func configure() {
circlePathLayer.frame = bounds
circlePathLayer.lineWidth = self.lineWidth
- circlePathLayer.fillColor = UIColor.clearColor().CGColor
- circlePathLayer.strokeColor = self.color.CGColor
+ circlePathLayer.fillColor = UIColor.clear.cgColor
+ circlePathLayer.strokeColor = self.color.cgColor
circlePathLayer.strokeEnd = 0.9
layer.addSublayer(circlePathLayer)
- backgroundColor = UIColor.whiteColor()
+ backgroundColor = UIColor.white
}
-}
\ No newline at end of file
+}
diff --git a/SWActivityIndicatorView.podspec b/SWActivityIndicatorView.podspec
index bb8f846..4d87013 100644
--- a/SWActivityIndicatorView.podspec
+++ b/SWActivityIndicatorView.podspec
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SWActivityIndicatorView"
- s.version = "1.0.0"
+ s.version = "2.0.0"
s.summary = "A simple flat activity indicator view."
# This description is used to generate tags and improve search results.