mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix lint issues.
This commit is contained in:
@@ -16,9 +16,9 @@ enum ArticleExtractorButtonState {
|
||||
}
|
||||
|
||||
class ArticleExtractorButton: UIButton {
|
||||
|
||||
|
||||
private var animatedLayer: CALayer?
|
||||
|
||||
|
||||
var buttonState: ArticleExtractorButtonState = .off {
|
||||
didSet {
|
||||
if buttonState != oldValue {
|
||||
@@ -39,7 +39,7 @@ class ArticleExtractorButton: UIButton {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get {
|
||||
switch buttonState {
|
||||
@@ -57,7 +57,7 @@ class ArticleExtractorButton: UIButton {
|
||||
super.accessibilityLabel = newValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
guard case .animated = buttonState else {
|
||||
@@ -66,31 +66,31 @@ class ArticleExtractorButton: UIButton {
|
||||
stripAnimatedSublayer()
|
||||
addAnimatedSublayer(to: layer)
|
||||
}
|
||||
|
||||
|
||||
private func stripAnimatedSublayer() {
|
||||
animatedLayer?.removeFromSuperlayer()
|
||||
}
|
||||
|
||||
|
||||
private func addAnimatedSublayer(to hostedLayer: CALayer) {
|
||||
let image1 = AppAssets.articleExtractorOffTinted.cgImage!
|
||||
let image2 = AppAssets.articleExtractorOnTinted.cgImage!
|
||||
let images = [image1, image2, image1]
|
||||
|
||||
|
||||
animatedLayer = CALayer()
|
||||
let imageSize = AppAssets.articleExtractorOff.size
|
||||
animatedLayer!.bounds = CGRect(x: 0, y: 0, width: imageSize.width, height: imageSize.height)
|
||||
animatedLayer!.position = CGPoint(x: bounds.midX, y: bounds.midY)
|
||||
|
||||
|
||||
hostedLayer.addSublayer(animatedLayer!)
|
||||
|
||||
|
||||
let animation = CAKeyframeAnimation(keyPath: "contents")
|
||||
animation.calculationMode = CAAnimationCalculationMode.linear
|
||||
animation.keyTimes = [0, 0.5, 1]
|
||||
animation.duration = 2
|
||||
animation.values = images as [Any]
|
||||
animation.repeatCount = HUGE
|
||||
|
||||
|
||||
animatedLayer!.add(animation, forKey: "contents")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user