Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit 0c0dbec

Browse files
committed
Fixed all SwiftLint violations
1 parent 2254e84 commit 0c0dbec

8 files changed

+31
-39
lines changed

.github/workflows/core_data_tests.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ jobs:
4141
run: |
4242
sh ./bootstrap.sh
4343
pod install
44-
#Disable for now, too many swift lint items :/
45-
#- name: Run code validation
46-
#run: bundle exec danger
47-
#env:
48-
# DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_TOKEN }}
44+
- name: Run code validation
45+
run: bundle exec danger
46+
env:
47+
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_TOKEN }}
4948
- name: Run tests
5049
run: bundle exec fastlane scan
5150
env:

CoreData_Models/CommentModel+CoreDataProperties.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//
88
//
99

10-
import Foundation
1110
import CoreData
11+
import Foundation
1212

1313
extension CommentModel {
1414

CoreData_Models/SubmissionComments+CoreDataProperties.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//
88
//
99

10-
import Foundation
1110
import CoreData
11+
import Foundation
1212

1313
extension SubmissionComments {
1414

CoreData_Models/SubmissionModel+CoreDataClass.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//
88
//
99

10-
import Foundation
1110
import CoreData
11+
import Foundation
1212

1313
@objc(SubmissionModel)
1414
public class SubmissionModel: NSManagedObject {

CoreData_Models/SubredditPosts+CoreDataClass.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//
88
//
99

10-
import Foundation
1110
import CoreData
11+
import Foundation
1212

1313
@objc(SubredditPosts)
1414
public class SubredditPosts: NSManagedObject {

Slide for Reddit/Onboarding2/OnboardingViewController.swift

+7-12
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,13 @@ import UIKit
1313
class OnboardingViewController: UIViewController {
1414

1515
let models: [OnboardingPageViewModel] = [
16-
.splash(text: "Welcome to\nSlide v6", subText: "Swipe to see what's new", image: UIImage(named: "ic_retroapple")!),
17-
.video(text: "Subreddits have a new home!", subText: "Swipe from the left edge of the homepage to access your profile, search, and communities.", video: "v6howtonavigate", aspectRatio: 0.679),
18-
.hardcodedChangelog(order: ["Subreddits have a new home",
19-
"iOS 14 ready", "Your subreddits have a new look",
20-
"The details",
21-
],
22-
paragraphs: [
23-
"Subreddits have a new home": "Navigating your subreddits and favorite Slide features has never been easier! Simply swipe from the left edge of the homepage to view the new-and-improved navigation menu. \nClosed something by accident? Swipe from the right edge of any toolbar to go back to where you were!",
24-
"iOS 14 ready": "Cover your homescreen in widgets yet? We sure have. Be sure to check out the new Subreddit Shortcut and Hot Posts widgets!",
25-
"Your subreddits have a new look": "Subreddit colors and branding really come through in v6. Slide has already pulled themes from your favorite communities, but you can create your own styles using the improved Subreddit theme editor.",
26-
"The details": "• Search improvements across the board, including more accurate subreddit search results and quick previews of top search results when browsing posts\n• Gestures have been revamped, with a new style on submissions and improvements to the Gestures settings page\n• Pin your most-used Slide features to the navigation menu\n• Improved r/random support with a new navigation menu button\n• Media views will now show the title of the post you clicked from\n• New sorting indicators on the homepage and comments views\n• Added a History browser\n• Subreddit support for Siri Shortcuts\n• Redesigned split-page layout for iPad\n• Redesigned gestures system\n• Support for Reddit Galleries and Polls\n• Support for iPad Magic Keyboard\n• Pull-to-refresh is easier to do now\n• Reduced Slide’s memory usage by up to 70%\n• Bugs were squashed, performance was improved\n• Removed many bags of coffee (from my kitchen)",
27-
])
16+
//TODO this for 6.1
17+
.splash(text: "Welcome to\nSlide v6.1", subText: "Swipe to see what's new", image: UIImage(named: "ic_retroapple")!),
18+
.hardcodedChangelog(order: [
19+
"AutoCache, Revamped",
20+
], paragraphs: [
21+
"AutoCache, Revamped": "Something here",
22+
]),
2823
]
2924

3025
var pageViewController: OnboardingPageViewController!

Slide for Reddit/SplitMainViewController.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import Anchorage
1111
import AudioToolbox
1212
import BadgeSwift
1313
import MaterialComponents.MDCActivityIndicator
14-
import SDWebImage
15-
import SwiftyJSON
1614
import reddift
1715
import SDCAlertView
16+
import SDWebImage
1817
import StoreKit
18+
import SwiftyJSON
1919
import UIKit
2020
import WatchConnectivity
2121
#if canImport(WidgetKit)
@@ -443,7 +443,7 @@ class SplitMainViewController: MainViewController {
443443
keyWindow = UIApplication.shared.connectedScenes
444444
.filter({ $0.activationState == .foregroundActive })
445445
.map({ $0 as? UIWindowScene })
446-
.compactMap({$0})
446+
.compactMap({ $0 })
447447
.first?.windows
448448
.filter({ $0.isKeyWindow }).first
449449
}
@@ -490,7 +490,7 @@ class SplitMainViewController: MainViewController {
490490
keyWindow = UIApplication.shared.connectedScenes
491491
.filter({ $0.activationState == .foregroundActive })
492492
.map({ $0 as? UIWindowScene })
493-
.compactMap({$0})
493+
.compactMap({ $0 })
494494
.first?.windows
495495
.filter({ $0.isKeyWindow }).first
496496
}

Slide for Reddit/WebsiteViewController.swift

+12-14
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class WebsiteViewController: MediaViewController, WKNavigationDelegate {
2323
var needsReload = false
2424
var completionFound = false
2525
var csrfToken = ""
26-
26+
var progressObservation: NSKeyValueObservation?
27+
2728
var savedChallengeURL: String? //Used for login with Apple
2829
public var reloadCallback: (() -> Void)?
2930

@@ -245,17 +246,13 @@ class WebsiteViewController: MediaViewController, WKNavigationDelegate {
245246
var setObserver = false
246247
override func viewDidAppear(_ animated: Bool) {
247248
super.viewDidAppear(animated)
248-
webView.addObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress), options: .new, context: nil)
249-
setObserver = true
250-
}
251-
252-
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
253-
if keyPath == "estimatedProgress" {
254-
myProgressView.progress = Float(webView.estimatedProgress)
249+
250+
progressObservation = webView.observe(\.estimatedProgress, options: .new, changeHandler: { (webView, _) in
251+
self.myProgressView.progress = Float(webView.estimatedProgress)
255252
if webView.estimatedProgress > 0.98 {
256-
myProgressView.isHidden = true
257-
if needsReload { //Show a loader and wait for NSURLSession cache to sync Cookies. 3 seconds worked for me, but there is no event handler for this
258-
needsReload = false
253+
self.myProgressView.isHidden = true
254+
if self.needsReload { //Show a loader and wait for NSURLSession cache to sync Cookies. 3 seconds worked for me, but there is no event handler for this
255+
self.needsReload = false
259256
webView.alpha = 0
260257
webView.superview?.backgroundColor = ColorUtil.theme.backgroundColor
261258
let pending = UIAlertController(title: "Syncing with Reddit...", message: nil, preferredStyle: .alert)
@@ -269,7 +266,7 @@ class WebsiteViewController: MediaViewController, WKNavigationDelegate {
269266

270267
self.present(pending, animated: true, completion: nil)
271268

272-
checkCookiesUntilCompletion {
269+
self.checkCookiesUntilCompletion {
273270
self.completionFound = true
274271

275272
self.webView.reload()
@@ -278,9 +275,10 @@ class WebsiteViewController: MediaViewController, WKNavigationDelegate {
278275
}
279276
}
280277
} else {
281-
myProgressView.isHidden = false
278+
self.myProgressView.isHidden = false
282279
}
283-
}
280+
})
281+
setObserver = true
284282
}
285283

286284
func checkCookiesUntilCompletion(tries: Int = 0, _ completion: @escaping () -> Void) {

0 commit comments

Comments
 (0)