Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Source/ButtonProgressBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public class ButtonProgressBar: UIButton {
progressLayer.lineWidth = frame.height*2

layer.addSublayer(progressLayer)
self.bringSubview(toFront: titleLabel!)
self.bringSubview(toFront: imageView!)
self.bringSubviewToFront(titleLabel!)
self.bringSubviewToFront(imageView!)
}

required public init?(coder aDecoder: NSCoder) {
Expand Down Expand Up @@ -92,8 +92,8 @@ public class ButtonProgressBar: UIButton {
progressLayer.lineWidth = frame.height*2

layer.addSublayer(progressLayer)
self.bringSubview(toFront: titleLabel!)
self.bringSubview(toFront: imageView!)
self.bringSubviewToFront(titleLabel!)
self.bringSubviewToFront(imageView!)
}

/**
Expand All @@ -110,7 +110,7 @@ public class ButtonProgressBar: UIButton {
userInfo: padding,
repeats: true)
timer?.fire()
RunLoop.current.add(timer!, forMode: .defaultRunLoopMode)
RunLoop.current.add(timer!, forMode: .default)
}

@objc func animateIndeterminate(sender: Timer) {
Expand All @@ -119,7 +119,7 @@ public class ButtonProgressBar: UIButton {
stroke.fromValue = 0.0
stroke.toValue = 0.5
stroke.duration = time
stroke.fillMode = kCAFillModeForwards
stroke.fillMode = CAMediaTimingFillMode.forwards
stroke.isRemovedOnCompletion = false
stroke.timingFunction = CAMediaTimingFunction(controlPoints: 1, 0, 1, 1)
self.progressLayer.add(stroke, forKey: nil)
Expand Down Expand Up @@ -162,9 +162,9 @@ public class ButtonProgressBar: UIButton {
let stroke = CABasicAnimation(keyPath: "strokeEnd")
stroke.fromValue = self.progress
stroke.toValue = progress
stroke.fillMode = kCAFillModeForwards
stroke.fillMode = CAMediaTimingFillMode.forwards
stroke.isRemovedOnCompletion = false
stroke.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
stroke.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
self.progressLayer.add(stroke, forKey: nil)
}
self.progress = progress
Expand All @@ -173,13 +173,13 @@ public class ButtonProgressBar: UIButton {
/**
Set title label text.
*/
public override func setTitle(_ title: String?, for state: UIControlState) {
public override func setTitle(_ title: String?, for state: UIControl.State) {
super.setTitle(title, for: state)
}

/**
Show / Hide title text.
- Parameter _ hidden: Title hiddden if true, shown if false.
- Parameter _ hidden: Title hiddden if true, shown if false.
*/
public func hideTitle(_ hidden: Bool) {
titleLabel!.layer.opacity = hidden ? 0.0 : 1.0
Expand All @@ -198,9 +198,9 @@ public class ButtonProgressBar: UIButton {
completionAnim.keyPath = "transform"
completionAnim.fromValue = CATransform3DMakeScale(0.0, 0.0, 0.0)
completionAnim.toValue = CATransform3DIdentity
completionAnim.fillMode = kCAFillModeForwards
completionAnim.fillMode = CAMediaTimingFillMode.forwards
completionAnim.isRemovedOnCompletion = false
completionAnim.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
completionAnim.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
self.imageView?.layer.add(completionAnim, forKey: nil)
}
}
Expand Down