Commit b8aa3054 by Daniel Dahan

master: issue-653: Fixed TextField issue where the animation was not correctly…

master: issue-653: Fixed TextField issue where the animation was not correctly responding to a programmatic text update.
parent ef7b687b
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '2.4.7'
s.version = '2.4.8'
s.license = 'BSD-3-Clause'
s.summary = 'Material is an animation and graphics framework that brings Material Design to iOS with Swift 3.'
s.homepage = 'http://materialswift.com'
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.4.7</string>
<string>2.4.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -67,9 +67,6 @@ open class TextField: UITextField {
@IBInspectable
open var isPlaceholderAnimated = true
/// A Boolean that indicates if the TextField is in an animating state.
open internal(set) var isAnimating = false
/// A boolean indicating whether the text is empty.
open var isEmpty: Bool {
return 0 == text?.utf16.count
......@@ -367,10 +364,6 @@ open class TextField: UITextField {
open override func layoutSubviews() {
super.layoutSubviews()
guard !isAnimating else {
return
}
layoutShape()
reload()
}
......@@ -612,11 +605,10 @@ extension TextField {
return
}
guard isEmpty && !isAnimating else {
guard isEmpty else {
return
}
isAnimating = true
UIView.animate(withDuration: 0.15, animations: { [weak self] in
guard let s = self else {
return
......@@ -633,9 +625,7 @@ extension TextField {
}
s.placeholderLabel.y = -s.placeholderLabel.height + s.placeholderVerticalOffset
}) { [weak self] _ in
self?.isAnimating = false
}
})
}
/// The animation for the placeholder when editing ends.
......@@ -646,11 +636,10 @@ extension TextField {
return
}
guard isEmpty && !isAnimating else {
guard isEmpty else {
return
}
isAnimating = true
UIView.animate(withDuration: 0.15, animations: { [weak self] in
guard let s = self else {
return
......@@ -659,8 +648,6 @@ extension TextField {
s.placeholderLabel.transform = CGAffineTransform.identity
s.placeholderLabel.x = s.leftViewWidth
s.placeholderLabel.y = 0
}) { [weak self] _ in
self?.isAnimating = false
}
})
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment