Skip to content

Commit e882daf

Browse files
committed
Add .swiftlint.yml, fix warnings.
1 parent bebcdfa commit e882daf

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

.swiftlint.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
excluded:
2+
- Pods
3+
4+
line_length: 200
5+
type_name:
6+
min_length: 1 # only warning
7+
8+
identifier_name:
9+
min_length: 2
10+
11+
reporter: "xcode"

Sources/FontAnimation.swift

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ internal final class FontAnimation {
1414
private var target: Any
1515
private var selector: Selector
1616

17-
1817
init(target: Any, selector: Selector) {
1918
self.target = target
2019
self.selector = selector

Sources/TweePlaceholderTextField.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ open class TweePlaceholderTextField: UITextField {
136136
case .smoothly:
137137
self.minimizeFontAnimation.start()
138138
}
139-
}) { _ in
139+
}, completion: { _ in
140140
self.minimizeFontAnimation.stop()
141-
}
141+
})
142142
}
143143

144144
@objc private func minimizePlaceholderFontSize() {
@@ -170,10 +170,10 @@ open class TweePlaceholderTextField: UITextField {
170170
UIView.animate(withDuration: placeholderDuration, delay: 0, options: [.preferredFramesPerSecond60], animations: {
171171
self.layoutIfNeeded()
172172
self.maximizeFontAnimation.start()
173-
}) { _ in
173+
}, completion: { _ in
174174
self.maximizeFontAnimation.stop()
175175
// self.placeholderLabel.font = self.placeholderLabel.font.withSize(self.originalPlaceholderFontSize)
176-
}
176+
})
177177
}
178178

179179
@objc private func maximizePlaceholderFontSize() {

TweeTextField.xcodeproj/project.pbxproj

+18
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
92E7FC321FE0374500E58DF5 /* Sources */,
106106
92E7FC331FE0374500E58DF5 /* Frameworks */,
107107
92E7FC341FE0374500E58DF5 /* Resources */,
108+
9216E14D203C376B00ECD005 /* Run Script - SwiftLint */,
108109
);
109110
buildRules = (
110111
);
@@ -162,6 +163,23 @@
162163
};
163164
/* End PBXResourcesBuildPhase section */
164165

166+
/* Begin PBXShellScriptBuildPhase section */
167+
9216E14D203C376B00ECD005 /* Run Script - SwiftLint */ = {
168+
isa = PBXShellScriptBuildPhase;
169+
buildActionMask = 2147483647;
170+
files = (
171+
);
172+
inputPaths = (
173+
);
174+
name = "Run Script - SwiftLint";
175+
outputPaths = (
176+
);
177+
runOnlyForDeploymentPostprocessing = 0;
178+
shellPath = /bin/sh;
179+
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\necho \"\"\nelse\necho \"warning: SwiftLint not installed. Install it using brew install swiftlint.\"\nfi";
180+
};
181+
/* End PBXShellScriptBuildPhase section */
182+
165183
/* Begin PBXSourcesBuildPhase section */
166184
92E7FC321FE0374500E58DF5 /* Sources */ = {
167185
isa = PBXSourcesBuildPhase;

TweeTextField/AppDelegate.swift

-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
99

1010
var window: UIWindow?
1111

12-
1312
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
1413

1514
return true
1615
}
1716
}
18-

TweeTextField/ViewController.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extension String {
88

99
var isValidEmail: Bool {
1010
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
11-
return NSPredicate(format:"SELF MATCHES %@", emailRegEx).evaluate(with: self)
11+
return NSPredicate(format: "SELF MATCHES %@", emailRegEx).evaluate(with: self)
1212
}
1313
}
1414

@@ -26,7 +26,8 @@ final class ViewController: UIViewController {
2626
}
2727

2828
@IBAction private func confirm() {
29-
view.endEditing(true)
29+
emailTextField.becomeFirstResponder()
30+
// view.endEditing(true)
3031
}
3132

3233
@IBAction private func emailBeginEditing(_ sender: TweeAttributedTextField) {
@@ -41,4 +42,3 @@ final class ViewController: UIViewController {
4142
sender.showInfo("Email address is incorrect. Check it out")
4243
}
4344
}
44-

0 commit comments

Comments
 (0)