@@ -63,9 +63,7 @@ import UIKit
6363 private let placeholderInsets = CGPoint ( x: 0 , y: 6 )
6464 private let textFieldInsets = CGPoint ( x: 0 , y: 12 )
6565 private let inactiveBorderLayer = CALayer ( )
66- private let activeBorderLayer = CALayer ( )
67-
68- private var inactivePlaceholderPoint : CGPoint = CGPointZero
66+ private let activeBorderLayer = CALayer ( )
6967 private var activePlaceholderPoint : CGPoint = CGPointZero
7068
7169 // MARK: - TextFieldsEffects
@@ -83,29 +81,25 @@ import UIKit
8381 layer. addSublayer ( activeBorderLayer)
8482 addSubview ( placeholderLabel)
8583
86- inactivePlaceholderPoint = placeholderLabel. frame. origin
8784 activePlaceholderPoint = CGPoint ( x: placeholderLabel. frame. origin. x, y: placeholderLabel. frame. origin. y - placeholderLabel. frame. size. height - placeholderInsets. y)
8885 }
8986
9087 override public func animateViewsForTextEntry( ) {
91- UIView . animateWithDuration ( 0.3 , delay: 0.0 , usingSpringWithDamping: 0.8 , initialSpringVelocity: 1.0 , options: . BeginFromCurrentState, animations: ( {
92-
93- if self . text!. isEmpty {
88+ if text!. isEmpty {
89+ UIView . animateWithDuration ( 0.3 , delay: 0.0 , usingSpringWithDamping: 0.8 , initialSpringVelocity: 1.0 , options: . BeginFromCurrentState, animations: ( {
9490 self . placeholderLabel. frame. origin = CGPoint ( x: 10 , y: self . placeholderLabel. frame. origin. y)
9591 self . placeholderLabel. alpha = 0
96- }
97- } ) , completion: { ( completed) in
98-
99- self . layoutPlaceholderInTextRect ( )
100-
101- self . placeholderLabel. frame. origin = self . activePlaceholderPoint
102-
103- UIView . animateWithDuration ( 0.2 , animations: {
104- self . placeholderLabel. alpha = 0.5
105- } )
92+ } ) , completion: nil )
93+ }
94+
95+ layoutPlaceholderInTextRect ( )
96+ placeholderLabel. frame. origin = activePlaceholderPoint
97+
98+ UIView . animateWithDuration ( 0.2 , animations: {
99+ self . placeholderLabel. alpha = 0.5
106100 } )
107101
108- self . activeBorderLayer. frame = self . rectForBorder ( self . borderThickness. active, isFilled: true )
102+ activeBorderLayer. frame = self . rectForBorder ( self . borderThickness. active, isFilled: true )
109103 }
110104
111105 override public func animateViewsForTextDisplay( ) {
0 commit comments