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| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '2.4.7' s.version = '2.4.8'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'Material is an animation and graphics framework that brings Material Design to iOS with Swift 3.' s.summary = 'Material is an animation and graphics framework that brings Material Design to iOS with Swift 3.'
s.homepage = 'http://materialswift.com' s.homepage = 'http://materialswift.com'
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.4.7</string> <string>2.4.8</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -67,9 +67,6 @@ open class TextField: UITextField { ...@@ -67,9 +67,6 @@ open class TextField: UITextField {
@IBInspectable @IBInspectable
open var isPlaceholderAnimated = true 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. /// A boolean indicating whether the text is empty.
open var isEmpty: Bool { open var isEmpty: Bool {
return 0 == text?.utf16.count return 0 == text?.utf16.count
...@@ -367,10 +364,6 @@ open class TextField: UITextField { ...@@ -367,10 +364,6 @@ open class TextField: UITextField {
open override func layoutSubviews() { open override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
guard !isAnimating else {
return
}
layoutShape() layoutShape()
reload() reload()
} }
...@@ -612,11 +605,10 @@ extension TextField { ...@@ -612,11 +605,10 @@ extension TextField {
return return
} }
guard isEmpty && !isAnimating else { guard isEmpty else {
return return
} }
isAnimating = true
UIView.animate(withDuration: 0.15, animations: { [weak self] in UIView.animate(withDuration: 0.15, animations: { [weak self] in
guard let s = self else { guard let s = self else {
return return
...@@ -633,9 +625,7 @@ extension TextField { ...@@ -633,9 +625,7 @@ extension TextField {
} }
s.placeholderLabel.y = -s.placeholderLabel.height + s.placeholderVerticalOffset s.placeholderLabel.y = -s.placeholderLabel.height + s.placeholderVerticalOffset
}) { [weak self] _ in })
self?.isAnimating = false
}
} }
/// The animation for the placeholder when editing ends. /// The animation for the placeholder when editing ends.
...@@ -646,11 +636,10 @@ extension TextField { ...@@ -646,11 +636,10 @@ extension TextField {
return return
} }
guard isEmpty && !isAnimating else { guard isEmpty else {
return return
} }
isAnimating = true
UIView.animate(withDuration: 0.15, animations: { [weak self] in UIView.animate(withDuration: 0.15, animations: { [weak self] in
guard let s = self else { guard let s = self else {
return return
...@@ -659,8 +648,6 @@ extension TextField { ...@@ -659,8 +648,6 @@ extension TextField {
s.placeholderLabel.transform = CGAffineTransform.identity s.placeholderLabel.transform = CGAffineTransform.identity
s.placeholderLabel.x = s.leftViewWidth s.placeholderLabel.x = s.leftViewWidth
s.placeholderLabel.y = 0 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