File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed 
TextFieldEffects/TextFieldEffects Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ import UIKit
6868 /**
6969 The color of the placeholder text.
7070
71-  This property applies a color to the complete placeholder string. The default value for this property is a  black  color.
71+  This property applies a color to the complete placeholder string. The default value for this property is a dark gray  color.
7272 */
7373 @IBInspectable   dynamic  public  var  placeholderColor :  UIColor  =  . darkGrayColor( )  { 
7474 didSet { 
@@ -139,10 +139,14 @@ import UIKit
139139
140140 private  func  animateViews( )  { 
141141 UIView . animateWithDuration ( 0.2 ,  animations:  { 
142-  self . placeholderLabel. alpha =  0 
142+  // Prevents a "flash" in the placeholder
143+  if  self . text!. isEmpty { 
144+  self . placeholderLabel. alpha =  0 
145+  } 
146+  
143147 self . placeholderLabel. frame =  self . placeholderRectForBounds ( self . bounds) 
144148
145-    } )  {  complete in 
149+  } )  {  complete in 
146150 self . updatePlaceholder ( ) 
147151 UIView . animateWithDuration ( 0.3 ,  animations:  { 
148152 self . placeholderLabel. alpha =  1 
@@ -155,14 +159,10 @@ import UIKit
155159 // MARK: - TextFieldEffects
156160
157161 override public  func  animateViewsForTextEntry( )  { 
158-  guard  text!. isEmpty else  {  return  } 
159-  
160162 animateViews ( ) 
161163 } 
162164
163165 override public  func  animateViewsForTextDisplay( )  { 
164-  guard  text!. isEmpty else  {  return  } 
165-  
166166 animateViews ( ) 
167167 } 
168168
                         You can’t perform that action at this time. 
           
                  
0 commit comments