year in review testing animation on label
Signed-off-by: Jarrod Courtney <jarrod.courtney@verizon.com>
This commit is contained in:
parent
add7eee2f7
commit
2fd4f3552f
@ -185,6 +185,13 @@ public typealias ActionBlock = () -> ()
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func fadeIn(duration: TimeInterval = 1.5, completion: ((Bool) -> Void)? = nil) {
|
||||||
|
self.alpha = 0.0
|
||||||
|
UIView.animate(withDuration: duration, delay: 0.2, animations: {
|
||||||
|
self.alpha = 1.0
|
||||||
|
}, completion: completion)
|
||||||
|
}
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
shouldMaskWhileRecording = viewModel.shouldMaskRecordedView ?? false
|
shouldMaskWhileRecording = viewModel.shouldMaskRecordedView ?? false
|
||||||
text = viewModel.text
|
text = viewModel.text
|
||||||
@ -226,6 +233,10 @@ public typealias ActionBlock = () -> ()
|
|||||||
attributes = attributeModels
|
attributes = attributeModels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let animate = viewModel.animationEnabled, animate == true {
|
||||||
|
self.fadeIn()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateAccessibility() {
|
open override func updateAccessibility() {
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import VDS
|
|||||||
public var shouldMaskRecordedView: Bool? = false
|
public var shouldMaskRecordedView: Bool? = false
|
||||||
public var accessibilityTraits: UIAccessibilityTraits?
|
public var accessibilityTraits: UIAccessibilityTraits?
|
||||||
public var inverted: Bool = false
|
public var inverted: Bool = false
|
||||||
|
public var animationEnabled: Bool?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
@ -55,6 +56,7 @@ import VDS
|
|||||||
case numberOfLines
|
case numberOfLines
|
||||||
case shouldMaskRecordedView
|
case shouldMaskRecordedView
|
||||||
case accessibilityTraits
|
case accessibilityTraits
|
||||||
|
case animationEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AttributeTypeKey: String, CodingKey {
|
enum AttributeTypeKey: String, CodingKey {
|
||||||
@ -104,6 +106,7 @@ import VDS
|
|||||||
numberOfLines = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfLines)
|
numberOfLines = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfLines)
|
||||||
shouldMaskRecordedView = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskRecordedView) ?? false
|
shouldMaskRecordedView = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskRecordedView) ?? false
|
||||||
accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits)
|
accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits)
|
||||||
|
animationEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .animationEnabled)
|
||||||
|
|
||||||
// Later make protocol based validate outside of decoding?
|
// Later make protocol based validate outside of decoding?
|
||||||
if let attributes = attributes {
|
if let attributes = attributes {
|
||||||
@ -131,6 +134,7 @@ import VDS
|
|||||||
try container.encodeIfPresent(numberOfLines, forKey: .numberOfLines)
|
try container.encodeIfPresent(numberOfLines, forKey: .numberOfLines)
|
||||||
try container.encodeIfPresent(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
try container.encodeIfPresent(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
||||||
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
||||||
|
try container.encodeIfPresent(animationEnabled, forKey: .animationEnabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user