Skip to content

Commit 9ee6d20

Browse files
committed
Resolve SwiftLint errors
1 parent b7963f1 commit 9ee6d20

File tree

9 files changed

+23
-16
lines changed

9 files changed

+23
-16
lines changed

.swiftlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ disabled_rules:
22
- force_try
33
- line_length
44
- nesting
5+
- variable_name
56
- vertical_whitespace
67
type_name:
78
excluded:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

iCookTV/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5757

5858
TreasureData.sharedInstance().uploadEvents(callback: { [weak self] in
5959
self?.endBackgroundTask(inApplication: application)
60-
}) { [weak self] _ in
60+
}, onError: { [weak self] _ in
6161
self?.endBackgroundTask(inApplication: application)
62-
}
62+
})
6363
#endif
6464
}
6565

iCookTV/Controllers/HistoryViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class HistoryViewController: UIViewController,
5959
get {
6060
return R.string.localizable.history()
6161
}
62-
set {}
62+
set {} // swiftlint:disable:this unused_setter_value
6363
}
6464

6565
override func loadView() {

iCookTV/Controllers/LaunchViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ class LaunchViewController: UIViewController, DataFetching {
122122
self.lowerTaglineConstraint?.constant = 0
123123
self.view.layoutIfNeeded()
124124
}
125-
}) { _ in
125+
}, completion: { _ in
126126
self.semaphore.signal()
127127
self.isAnimating = false
128-
}
128+
})
129129
}
130130

131131
// MARK: - Private Methods

iCookTV/Extensions/DataRequest+Result.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ enum Result<T> {
4141

4242
func mapError(_ transform: (Error) -> Void) -> Result<T> {
4343
switch self {
44-
case .success(_): break
44+
case .success: break
4545
case .failure(let error): transform(error)
4646
}
4747
return self

iCookTV/Helpers/HistoryManager.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ struct HistoryManager {
7575
var records = history
7676

7777
// Keep the latest video at top.
78-
for (index, element) in self.history.enumerated() {
79-
if element["id"] == json["id"] {
80-
records.remove(at: index)
81-
break
82-
}
78+
for (index, element) in self.history.enumerated() where element["id"] == json["id"] {
79+
records.remove(at: index)
80+
break
8381
}
8482
records.insert(json, at: 0)
8583
Debug.print("records.count =", records.count)

iCookTV/Protocols/OverlayViewPresentable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extension OverlayViewPresentable where Self: UIViewController {
6868
}
6969

7070
private func layoutOverlayViewIfNeeded() {
71-
if let _ = overlayView.superview {
71+
if overlayView.superview != nil {
7272
return
7373
}
7474

iCookTV/Protocols/Reusable.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ extension UICollectionReusableView: Reusable {}
4848

4949
extension UICollectionView {
5050

51-
func register<T: UICollectionViewCell>(cell type: T.Type) where T: Reusable {
51+
func register<T: UICollectionViewCell>(cell type: T.Type) {
5252
register(type, forCellWithReuseIdentifier: type.reuseIdentifier)
5353
}
5454

55-
func register<T: UICollectionReusableView>(supplementaryView type: T.Type, ofKind kind: String) where T: Reusable {
55+
func register<T: UICollectionReusableView>(supplementaryView type: T.Type, ofKind kind: String) {
5656
register(type, forSupplementaryViewOfKind: kind, withReuseIdentifier: type.reuseIdentifier)
5757
}
5858

59-
func dequeueReusableCell<T: UICollectionViewCell>(type: T.Type = T.self, for indexPath: IndexPath) -> T where T: Reusable {
59+
func dequeueReusableCell<T: UICollectionViewCell>(type: T.Type = T.self, for indexPath: IndexPath) -> T {
6060
if let cell = dequeueReusableCell(withReuseIdentifier: type.reuseIdentifier, for: indexPath) as? T {
6161
return cell
6262
} else {
6363
return type.init()
6464
}
6565
}
6666

67-
func dequeueReusableSupplementaryView<T: UICollectionReusableView>(type: T.Type = T.self, ofKind kind: String, for indexPath: IndexPath) -> T where T: Reusable {
67+
func dequeueReusableSupplementaryView<T: UICollectionReusableView>(type: T.Type = T.self, ofKind kind: String, for indexPath: IndexPath) -> T {
6868
if let view = dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: type.reuseIdentifier, for: indexPath) as? T {
6969
return view
7070
} else {

0 commit comments

Comments
 (0)