Skip to content

Commit 28a337c

Browse files
mojganiibuggmagnet
authored andcommitted
Fix some Swiftlint warnings
1 parent a14ae14 commit 28a337c

File tree

10 files changed

+15
-20
lines changed

10 files changed

+15
-20
lines changed

ios/MullvadREST/ApiHandlers/RESTRequestFactory.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension REST {
1616
let networkTimeout: Duration
1717
let bodyEncoder: JSONEncoder
1818

19-
class func withDefaultAPICredentials(
19+
static func withDefaultAPICredentials(
2020
pathPrefix: String,
2121
bodyEncoder: JSONEncoder
2222
) -> RequestFactory {

ios/MullvadSettings/SettingsManager.swift

+1-6
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ public enum SettingsManager {
4747

4848
public static func getLastUsedAccount() throws -> String {
4949
let data = try store.read(key: .lastUsedAccount)
50-
51-
if let string = String(data: data, encoding: .utf8) {
52-
return string
53-
} else {
54-
throw StringDecodingError(data: data)
55-
}
50+
return String(decoding: data, as: UTF8.self)
5651
}
5752

5853
public static func setLastUsedAccount(_ string: String?) throws {

ios/MullvadVPN/StorePaymentManager/StorePaymentManager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ final class StorePaymentManager: NSObject, SKPaymentTransactionObserver {
4444
private var paymentToAccountToken = [SKPayment: String]()
4545

4646
/// Returns true if the device is able to make payments.
47-
class var canMakePayments: Bool {
47+
static var canMakePayments: Bool {
4848
SKPaymentQueue.canMakePayments()
4949
}
5050

ios/MullvadVPN/View controllers/SelectLocation/LocationCellViewModel.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ extension LocationCellViewModel {
8080
return false
8181
}
8282

83-
var proxyNode = RootLocationNode(children: [node])
83+
let proxyNode = RootLocationNode(children: [node])
8484
let allLocations = Set(proxyNode.flattened.flatMap { $0.locations })
8585
let hostCount = allLocations.filter { location in
8686
if case .hostname = location { true } else { false }

ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ final class TunnelControlView: UIView {
388388
)
389389
}
390390

391-
private class func makeBoldTextLabel(ofSize fontSize: CGFloat, numberOfLines: Int = 1) -> UILabel {
391+
private static func makeBoldTextLabel(ofSize fontSize: CGFloat, numberOfLines: Int = 1) -> UILabel {
392392
let textLabel = UILabel()
393393
textLabel.translatesAutoresizingMaskIntoConstraints = false
394394
textLabel.font = UIFont.boldSystemFont(ofSize: fontSize)

ios/MullvadVPNTests/MullvadSettings/APIAccessMethodsTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import XCTest
1313
final class APIAccessMethodsTests: XCTestCase {
1414
static let store = InMemorySettingsStore<SettingNotFound>()
1515

16-
override class func setUp() {
16+
override static func setUp() {
1717
SettingsManager.unitTestStore = store
1818
}
1919

20-
override class func tearDown() {
20+
override static func tearDown() {
2121
SettingsManager.unitTestStore = nil
2222
}
2323

ios/MullvadVPNTests/MullvadSettings/IPOverrideRepositoryTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ final class IPOverrideRepositoryTests: XCTestCase {
1414
static let store = InMemorySettingsStore<SettingNotFound>()
1515
let repository = IPOverrideRepository()
1616

17-
override class func setUp() {
17+
override static func setUp() {
1818
SettingsManager.unitTestStore = store
1919
}
2020

21-
override class func tearDown() {
21+
override static func tearDown() {
2222
SettingsManager.unitTestStore = nil
2323
}
2424

ios/MullvadVPNTests/MullvadSettings/MigrationManagerTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ final class MigrationManagerTests: XCTestCase {
1616
static let store = InMemorySettingsStore<SettingNotFound>()
1717

1818
var manager: MigrationManager!
19-
override class func setUp() {
19+
override static func setUp() {
2020
SettingsManager.unitTestStore = store
2121
}
2222

23-
override class func tearDown() {
23+
override static func tearDown() {
2424
SettingsManager.unitTestStore = nil
2525
}
2626

@@ -72,7 +72,7 @@ final class MigrationManagerTests: XCTestCase {
7272

7373
func testFailedMigrationResetsSettings() throws {
7474
let store = Self.store
75-
let data = try XCTUnwrap("Migration test".data(using: .utf8))
75+
let data = Data("Migration test".utf8)
7676
try store.write(data, for: .settings)
7777
try store.write(data, for: .deviceState)
7878

ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelManagerTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class TunnelManagerTests: XCTestCase {
2727

2828
var transportProvider: TransportProvider!
2929

30-
override class func setUp() {
30+
override static func setUp() {
3131
SettingsManager.unitTestStore = store
3232
}
3333

34-
override class func tearDown() {
34+
override static func tearDown() {
3535
SettingsManager.unitTestStore = nil
3636
}
3737

ios/PacketTunnelCore/Pinger/Pinger.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public final class Pinger: PingerProtocol {
217217
}
218218
}
219219

220-
private class func makeIPAddress(from sa: sockaddr) -> IPAddress? {
220+
private static func makeIPAddress(from sa: sockaddr) -> IPAddress? {
221221
if sa.sa_family == AF_INET {
222222
return withUnsafeBytes(of: sa) { buffer -> IPAddress? in
223223
buffer.bindMemory(to: sockaddr_in.self).baseAddress.flatMap { boundPointer in

0 commit comments

Comments
 (0)