@@ -79,25 +79,36 @@ import UIKit
7979 } 
8080
8181 override open  func  animateViewsForTextEntry( )  { 
82-  borderLayer. borderColor =  textColor? . cgColor
83-  borderLayer. shadowOffset =  CGSize . zero
84-  borderLayer. borderWidth =  borderThickness
85-  borderLayer. shadowColor =  textColor? . cgColor
86-  borderLayer. shadowOpacity =  0.5 
87-  borderLayer. shadowRadius =  1 
82+  UIView . animate ( withDuration:  0.5 ,  delay:  0 ,  usingSpringWithDamping:  1.0 ,  initialSpringVelocity:  0.6 ,  options:  . beginFromCurrentState,  animations:  { 
8883
89-  animationCompletionHandler ? ( . textEntry) 
84+  self . borderLayer. borderColor =  self . textColor? . cgColor
85+  self . borderLayer. shadowOffset =  CGSize . zero
86+  self . borderLayer. borderWidth =  self . borderThickness
87+  self . borderLayer. shadowColor =  self . textColor? . cgColor
88+  self . borderLayer. shadowOpacity =  0.5 
89+  self . borderLayer. shadowRadius =  1 
90+  
91+  } ,  completion:  {  _ in 
92+  self . animationCompletionHandler ? ( . textEntry) 
93+  } ) 
9094 } 
9195
9296 override open  func  animateViewsForTextDisplay( )  { 
93-  borderLayer. borderColor =  nil 
94-  borderLayer. shadowOffset =  CGSize . zero
95-  borderLayer. borderWidth =  0 
96-  borderLayer. shadowColor =  nil 
97-  borderLayer. shadowOpacity =  0 
98-  borderLayer. shadowRadius =  0 
97+  if  text!. isEmpty { 
98+  UIView . animate ( withDuration:  0.5 ,  delay:  0 ,  usingSpringWithDamping:  1.0 ,  initialSpringVelocity:  0.6 ,  options:  . beginFromCurrentState,  animations:  { 
99+ 
100+  self . borderLayer. borderColor =  nil 
101+  self . borderLayer. shadowOffset =  CGSize . zero
102+  self . borderLayer. borderWidth =  0 
103+  self . borderLayer. shadowColor =  nil 
104+  self . borderLayer. shadowOpacity =  0 
105+  self . borderLayer. shadowRadius =  0 
106+  } ,  completion:  {  _ in 
99107
100-  animationCompletionHandler ? ( . textDisplay) 
108+  self . animationCompletionHandler ? ( . textDisplay) 
109+  } ) 
110+  
111+  } 
101112 } 
102113
103114 // MARK: - Private
0 commit comments