Skip to content

Commit f9b99bf

Browse files
authored
Merge pull request #20 from WingTel/master
support to swift 4
2 parents def41b3 + a95b330 commit f9b99bf

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

PasswordTextField.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@
10051005
PRODUCT_NAME = "$(TARGET_NAME)";
10061006
SKIP_INSTALL = YES;
10071007
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1008-
SWIFT_VERSION = 3.0;
1008+
SWIFT_VERSION = 4.0;
10091009
};
10101010
name = Debug;
10111011
};
@@ -1025,7 +1025,7 @@
10251025
PRODUCT_BUNDLE_IDENTIFIER = com.greenpixels.PasswordTextField;
10261026
PRODUCT_NAME = "$(TARGET_NAME)";
10271027
SKIP_INSTALL = YES;
1028-
SWIFT_VERSION = 3.0;
1028+
SWIFT_VERSION = 4.0;
10291029
};
10301030
name = Release;
10311031
};

PasswordTextField/PasswordTextField.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ open class PasswordTextField: UITextField {
148148
self.isSecureTextEntry = true
149149
self.autocapitalizationType = .none
150150
self.autocorrectionType = .no
151-
self.keyboardType = .asciiCapable
151+
// Note from Camilo -> Removing so it can be set from XIB
152+
//self.keyboardType = .asciiCapable
152153
self.rightViewMode = self.showButtonWhile.textViewMode
153154
self.rightView = self.secureTextButton
154155

@@ -174,16 +175,18 @@ open class PasswordTextField: UITextField {
174175
*/
175176
open func setSecureMode(_ secure:Bool)
176177
{
177-
178-
self.resignFirstResponder()
178+
179+
// Note by Camilo: it cause weird animation.
180+
//self.resignFirstResponder()
179181
self.isSecureTextEntry = secure
180182

181183
/// Kind of ugly hack to make the text refresh after the toggle. The size of the secure fonts are different than the normal ones and it shows trailing white space
182184
let tempText = self.text;
183185
self.text = " ";
184186
self.text = tempText;
185-
186-
self.becomeFirstResponder()
187+
188+
// Note by Camilo: it cause weird animation.
189+
//self.becomeFirstResponder()
187190

188191
}
189192

PasswordTextField/SecureTextToggleButton.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ open class SecureTextToggleButton: UIButton {
1818
fileprivate let Height:CGFloat = 20.0
1919

2020
/// Sets the value for the secure or note secure toggle and
21-
dynamic open var isSecure:Bool = true{
21+
@objc dynamic open var isSecure:Bool = true{
2222

2323
didSet{
2424

@@ -135,7 +135,7 @@ open class SecureTextToggleButton: UIButton {
135135
/**
136136
Toggle the icon
137137
*/
138-
open func buttonTouch()
138+
@objc open func buttonTouch()
139139
{
140140
self.isSecure = !self.isSecure
141141
}

0 commit comments

Comments
 (0)