Skip to content

Commit 0c60b93

Browse files
committed
Support for Swift 3.0-b8
1 parent 5881d14 commit 0c60b93

File tree

10 files changed

+45
-45
lines changed

10 files changed

+45
-45
lines changed

TextFieldEffects/TextFieldEffects/AkiraTextField.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import UIKit
3434

3535
This property applies a color to the complete placeholder string. The default value for this property is a black color.
3636
*/
37-
@IBInspectable dynamic public var placeholderColor: UIColor = .black() {
37+
@IBInspectable dynamic public var placeholderColor: UIColor = .black {
3838
didSet {
3939
updatePlaceholder()
4040
}
@@ -78,7 +78,7 @@ import UIKit
7878
self.updateBorder()
7979
self.updatePlaceholder()
8080
}, completion: { _ in
81-
self.animationCompletionHandler?(type: .textEntry)
81+
self.animationCompletionHandler?(.textEntry)
8282
})
8383
}
8484

@@ -87,7 +87,7 @@ import UIKit
8787
self.updateBorder()
8888
self.updatePlaceholder()
8989
}, completion: { _ in
90-
self.animationCompletionHandler?(type: .textDisplay)
90+
self.animationCompletionHandler?(.textDisplay)
9191
})
9292
}
9393

@@ -103,7 +103,7 @@ import UIKit
103103

104104
private func updateBorder() {
105105
borderLayer.frame = rectForBounds(bounds)
106-
borderLayer.borderWidth = (isFirstResponder() || text!.isNotEmpty) ? borderSize.active : borderSize.inactive
106+
borderLayer.borderWidth = (isFirstResponder || text!.isNotEmpty) ? borderSize.active : borderSize.inactive
107107
borderLayer.borderColor = borderColor?.cgColor
108108
}
109109

@@ -123,7 +123,7 @@ import UIKit
123123
// MARK: - Overrides
124124

125125
public override func placeholderRect(forBounds bounds: CGRect) -> CGRect {
126-
if isFirstResponder() || text!.isNotEmpty {
126+
if isFirstResponder || text!.isNotEmpty {
127127
return CGRect(x: placeHolderInsets.x, y: placeHolderInsets.y, width: bounds.width, height: placeholderHeight)
128128
} else {
129129
return textRect(forBounds: bounds)

TextFieldEffects/TextFieldEffects/HoshiTextField.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import UIKit
4040

4141
This property applies a color to the complete placeholder string. The default value for this property is a black color.
4242
*/
43-
@IBInspectable dynamic public var placeholderColor: UIColor = .black() {
43+
@IBInspectable dynamic public var placeholderColor: UIColor = .black {
4444
didSet {
4545
updatePlaceholder()
4646
}
@@ -99,7 +99,7 @@ import UIKit
9999
self.placeholderLabel.frame.origin = CGPoint(x: 10, y: self.placeholderLabel.frame.origin.y)
100100
self.placeholderLabel.alpha = 0
101101
}), completion: { _ in
102-
self.animationCompletionHandler?(type: .textEntry)
102+
self.animationCompletionHandler?(.textEntry)
103103
})
104104
}
105105

@@ -119,7 +119,7 @@ import UIKit
119119
self.layoutPlaceholderInTextRect()
120120
self.placeholderLabel.alpha = 1
121121
}), completion: { _ in
122-
self.animationCompletionHandler?(type: .textDisplay)
122+
self.animationCompletionHandler?(.textDisplay)
123123
})
124124

125125
activeBorderLayer.frame = self.rectForBorder(self.borderThickness.active, isFilled: false)
@@ -142,7 +142,7 @@ import UIKit
142142
placeholderLabel.sizeToFit()
143143
layoutPlaceholderInTextRect()
144144

145-
if isFirstResponder() || text!.isNotEmpty {
145+
if isFirstResponder || text!.isNotEmpty {
146146
animateViewsForTextEntry()
147147
}
148148
}

TextFieldEffects/TextFieldEffects/IsaoTextField.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ import UIKit
9797

9898
private func updateBorder() {
9999
borderLayer.frame = rectForBorder(frame)
100-
borderLayer.backgroundColor = isFirstResponder() ? activeColor?.cgColor : inactiveColor?.cgColor
100+
borderLayer.backgroundColor = isFirstResponder ? activeColor?.cgColor : inactiveColor?.cgColor
101101
}
102102

103103
private func updatePlaceholder() {
@@ -106,7 +106,7 @@ import UIKit
106106
placeholderLabel.sizeToFit()
107107
layoutPlaceholderInTextRect()
108108

109-
if isFirstResponder() {
109+
if isFirstResponder {
110110
animateViewsForTextEntry()
111111
}
112112
}
@@ -119,7 +119,7 @@ import UIKit
119119
private func rectForBorder(_ bounds: CGRect) -> CGRect {
120120
var newRect:CGRect
121121

122-
if isFirstResponder() {
122+
if isFirstResponder {
123123
newRect = CGRect(x: 0, y: bounds.size.height - font!.lineHeight + textFieldInsets.y - borderThickness.active, width: bounds.size.width, height: borderThickness.active)
124124
} else {
125125
newRect = CGRect(x: 0, y: bounds.size.height - font!.lineHeight + textFieldInsets.y - borderThickness.inactive, width: bounds.size.width, height: borderThickness.inactive)
@@ -159,7 +159,7 @@ import UIKit
159159
self.placeholderLabel.transform = CGAffineTransform.identity
160160
self.placeholderLabel.alpha = 1
161161
}) { _ in
162-
self.animationCompletionHandler?(type: self.isFirstResponder() ? .textEntry : .textDisplay)
162+
self.animationCompletionHandler?(self.isFirstResponder ? .textEntry : .textDisplay)
163163
}
164164
}
165165
}

TextFieldEffects/TextFieldEffects/JiroTextField.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import UIKit
2929

3030
This property applies a color to the complete placeholder string. The default value for this property is a black color.
3131
*/
32-
@IBInspectable dynamic public var placeholderColor: UIColor = .black() {
32+
@IBInspectable dynamic public var placeholderColor: UIColor = .black {
3333
didSet {
3434
updatePlaceholder()
3535
}
@@ -88,7 +88,7 @@ import UIKit
8888
self.borderLayer.frame = self.rectForBorder(self.borderThickness, isFilled: true)
8989

9090
}), completion: { _ in
91-
self.animationCompletionHandler?(type: .textEntry)
91+
self.animationCompletionHandler?(.textEntry)
9292
})
9393
}
9494

@@ -98,7 +98,7 @@ import UIKit
9898
self.layoutPlaceholderInTextRect()
9999
self.placeholderLabel.alpha = 1
100100
}), completion: { _ in
101-
self.animationCompletionHandler?(type: .textDisplay)
101+
self.animationCompletionHandler?(.textDisplay)
102102
})
103103

104104
borderLayer.frame = rectForBorder(borderThickness, isFilled: false)
@@ -118,7 +118,7 @@ import UIKit
118118
placeholderLabel.sizeToFit()
119119
layoutPlaceholderInTextRect()
120120

121-
if isFirstResponder() || text!.isNotEmpty {
121+
if isFirstResponder || text!.isNotEmpty {
122122
animateViewsForTextEntry()
123123
}
124124
}

TextFieldEffects/TextFieldEffects/KaedeTextField.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import UIKit
7575
updateForegroundColor()
7676
updatePlaceholder()
7777

78-
if text!.isNotEmpty || isFirstResponder() {
78+
if text!.isNotEmpty || isFirstResponder {
7979
animateViewsForTextEntry()
8080
}
8181

@@ -91,7 +91,7 @@ import UIKit
9191
UIView.animate(withDuration: 0.45, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 1.5, options: .beginFromCurrentState, animations: ({
9292
self.foregroundView.frame.origin = CGPoint(x: self.frame.size.width * 0.6, y: 0)
9393
}), completion: { _ in
94-
self.animationCompletionHandler?(type: .textEntry)
94+
self.animationCompletionHandler?(.textEntry)
9595
})
9696
}
9797

@@ -104,7 +104,7 @@ import UIKit
104104
UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: 2.0, options: .beginFromCurrentState, animations: ({
105105
self.foregroundView.frame.origin = CGPoint.zero
106106
}), completion: { _ in
107-
self.animationCompletionHandler?(type: .textDisplay)
107+
self.animationCompletionHandler?(.textDisplay)
108108
})
109109
}
110110
}

TextFieldEffects/TextFieldEffects/MadokaTextField.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import UIKit
1818

1919
This property applies a color to the complete placeholder string. The default value for this property is a black color.
2020
*/
21-
@IBInspectable dynamic public var placeholderColor: UIColor = .black() {
21+
@IBInspectable dynamic public var placeholderColor: UIColor = .black {
2222
didSet {
2323
updatePlaceholder()
2424
}
@@ -87,9 +87,9 @@ import UIKit
8787
let translate = CGAffineTransform(translationX: -self.placeholderInsets.x, y: self.placeholderLabel.bounds.height + (self.placeholderInsets.y * 2))
8888
let scale = CGAffineTransform(scaleX: 0.9, y: 0.9)
8989

90-
self.placeholderLabel.transform = translate.concat(scale)
90+
self.placeholderLabel.transform = translate.concatenating(scale)
9191
}) { _ in
92-
self.animationCompletionHandler?(type: .textEntry)
92+
self.animationCompletionHandler?(.textEntry)
9393
}
9494
}
9595

@@ -100,7 +100,7 @@ import UIKit
100100
UIView.animate(withDuration: 0.3, animations: {
101101
self.placeholderLabel.transform = CGAffineTransform.identity
102102
}) { _ in
103-
self.animationCompletionHandler?(type: .textDisplay)
103+
self.animationCompletionHandler?(.textDisplay)
104104
}
105105
}
106106
}
@@ -135,7 +135,7 @@ import UIKit
135135
placeholderLabel.sizeToFit()
136136
layoutPlaceholderInTextRect()
137137

138-
if isFirstResponder() || text!.isNotEmpty {
138+
if isFirstResponder || text!.isNotEmpty {
139139
animateViewsForTextEntry()
140140
}
141141
}

TextFieldEffects/TextFieldEffects/MinoruTextField.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import UIKit
1818

1919
This property applies a color to the complete placeholder string. The default value for this property is a black color.
2020
*/
21-
@IBInspectable dynamic public var placeholderColor: UIColor = .black() {
21+
@IBInspectable dynamic public var placeholderColor: UIColor = .black {
2222
didSet {
2323
updatePlaceholder()
2424
}
@@ -86,7 +86,7 @@ import UIKit
8686
borderLayer.shadowOpacity = 0.5
8787
borderLayer.shadowRadius = 1
8888

89-
animationCompletionHandler?(type: .textEntry)
89+
animationCompletionHandler?(.textEntry)
9090
}
9191

9292
override public func animateViewsForTextDisplay() {
@@ -97,7 +97,7 @@ import UIKit
9797
borderLayer.shadowOpacity = 0
9898
borderLayer.shadowRadius = 0
9999

100-
animationCompletionHandler?(type: .textDisplay)
100+
animationCompletionHandler?(.textDisplay)
101101
}
102102

103103
// MARK: - Private
@@ -113,7 +113,7 @@ import UIKit
113113
placeholderLabel.sizeToFit()
114114
layoutPlaceholderInTextRect()
115115

116-
if isFirstResponder() {
116+
if isFirstResponder {
117117
animateViewsForTextEntry()
118118
}
119119
}

TextFieldEffects/TextFieldEffects/TextFieldsEffects.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class TextFieldEffects : UITextField {
3636
/**
3737
Closure executed when an animation has been completed.
3838
*/
39-
public typealias AnimationCompletionHandler = (type: AnimationType)->()
39+
public typealias AnimationCompletionHandler = (_ type: AnimationType)->()
4040

4141
/**
4242
UILabel that holds all the placeholder information

TextFieldEffects/TextFieldEffects/YokoTextField.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import UIKit
4040

4141
The default value for this property is a clear color.
4242
*/
43-
@IBInspectable dynamic public var foregroundColor: UIColor = UIColor.black() {
43+
@IBInspectable dynamic public var foregroundColor: UIColor = .black {
4444
didSet {
4545
updateForeground()
4646
}
@@ -82,7 +82,7 @@ import UIKit
8282
self.foregroundView.layer.transform = CATransform3DIdentity
8383

8484
}, completion: { _ in
85-
self.animationCompletionHandler?(type: .textEntry)
85+
self.animationCompletionHandler?(.textEntry)
8686
})
8787

8888
foregroundLayer.frame = rectForBorder(foregroundView.frame, isFilled: false)
@@ -95,7 +95,7 @@ import UIKit
9595
self.foregroundLayer.frame = self.rectForBorder(self.foregroundView.frame, isFilled: true)
9696
self.foregroundView.layer.transform = self.rotationAndPerspectiveTransformForView(self.foregroundView)
9797
}, completion: { _ in
98-
self.animationCompletionHandler?(type: .textDisplay)
98+
self.animationCompletionHandler?(.textDisplay)
9999
})
100100
}
101101
}
@@ -120,7 +120,7 @@ import UIKit
120120
placeholderLabel.sizeToFit()
121121
layoutPlaceholderInTextRect()
122122

123-
if isFirstResponder() || text!.isNotEmpty {
123+
if isFirstResponder || text!.isNotEmpty {
124124
animateViewsForTextEntry()
125125
}
126126
}
@@ -167,8 +167,8 @@ import UIKit
167167
var newPoint:CGPoint = CGPoint(x: view.bounds.size.width * anchorPoint.x, y: view.bounds.size.height * anchorPoint.y)
168168
var oldPoint:CGPoint = CGPoint(x: view.bounds.size.width * view.layer.anchorPoint.x, y: view.bounds.size.height * view.layer.anchorPoint.y)
169169

170-
newPoint = newPoint.apply(transform: view.transform)
171-
oldPoint = oldPoint.apply(transform: view.transform)
170+
newPoint = newPoint.applying(view.transform)
171+
oldPoint = oldPoint.applying(view.transform)
172172

173173
var position = view.layer.position
174174

TextFieldEffects/TextFieldEffects/YoshikoTextField.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import UIKit
3333

3434
This property applies a color to the edges of the control. The default value for this property is a clear color.
3535
*/
36-
@IBInspectable dynamic public var activeBorderColor: UIColor = .clear() {
36+
@IBInspectable dynamic public var activeBorderColor: UIColor = .clear {
3737
didSet {
3838
updateBorder()
3939
updateBackground()
@@ -46,7 +46,7 @@ import UIKit
4646

4747
This property applies a color to the edges of the control. The default value for this property is a clear color.
4848
*/
49-
@IBInspectable dynamic public var inactiveBorderColor: UIColor = .clear() {
49+
@IBInspectable dynamic public var inactiveBorderColor: UIColor = .clear {
5050
didSet {
5151
updateBorder()
5252
updateBackground()
@@ -59,7 +59,7 @@ import UIKit
5959

6060
This property applies a color to the background of the input.
6161
*/
62-
@IBInspectable dynamic public var activeBackgroundColor: UIColor = .clear() {
62+
@IBInspectable dynamic public var activeBackgroundColor: UIColor = .clear {
6363
didSet {
6464
updateBackground()
6565
}
@@ -70,7 +70,7 @@ import UIKit
7070

7171
This property applies a color to the complete placeholder string. The default value for this property is a dark gray color.
7272
*/
73-
@IBInspectable dynamic public var placeholderColor: UIColor = .darkGray() {
73+
@IBInspectable dynamic public var placeholderColor: UIColor = .darkGray {
7474
didSet {
7575
updatePlaceholder()
7676
}
@@ -98,11 +98,11 @@ import UIKit
9898
private func updateBorder() {
9999
borderLayer.frame = rectForBounds(bounds)
100100
borderLayer.borderWidth = borderSize
101-
borderLayer.borderColor = (isFirstResponder() || text!.isNotEmpty) ? activeBorderColor.cgColor : inactiveBorderColor.cgColor
101+
borderLayer.borderColor = (isFirstResponder || text!.isNotEmpty) ? activeBorderColor.cgColor : inactiveBorderColor.cgColor
102102
}
103103

104104
private func updateBackground() {
105-
if isFirstResponder() || text!.isNotEmpty {
105+
if isFirstResponder || text!.isNotEmpty {
106106
borderLayer.backgroundColor = activeBackgroundColor.cgColor
107107
} else {
108108
borderLayer.backgroundColor = inactiveBorderColor.cgColor
@@ -114,7 +114,7 @@ import UIKit
114114
placeholderLabel.text = placeholder
115115
placeholderLabel.textAlignment = textAlignment
116116

117-
if isFirstResponder() || text!.isNotEmpty {
117+
if isFirstResponder || text!.isNotEmpty {
118118
placeholderLabel.font = placeholderFontFromFontAndPercentageOfOriginalSize(font: font!, percentageOfOriginalSize: placeholderFontScale * 0.8)
119119
placeholderLabel.text = placeholder?.uppercased()
120120
placeholderLabel.textColor = activeBorderColor
@@ -154,7 +154,7 @@ import UIKit
154154
self.updateBorder()
155155
self.updateBackground()
156156
}, completion: { _ in
157-
self.animationCompletionHandler?(type: self.isFirstResponder() ? .textEntry : .textDisplay)
157+
self.animationCompletionHandler?(self.isFirstResponder ? .textEntry : .textDisplay)
158158
})
159159
}
160160
}
@@ -189,7 +189,7 @@ import UIKit
189189
}
190190

191191
public override func placeholderRect(forBounds bounds: CGRect) -> CGRect {
192-
if isFirstResponder() || text!.isNotEmpty {
192+
if isFirstResponder || text!.isNotEmpty {
193193
return CGRect(x: placeHolderInsets.x, y: placeHolderInsets.y, width: bounds.width, height: placeholderHeight)
194194
} else {
195195
return textRect(forBounds: bounds)

0 commit comments

Comments
 (0)