Skip to content

Commit b2a0d9c

Browse files
authored
refactor: remove bool comparisons to decrease build times (#317)
1 parent b92667f commit b2a0d9c

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Sources/ParseSwift/Extensions/URLSession.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ internal extension URLSession {
6666
return .failure(error)
6767
}
6868
guard let parseError = error as? ParseError else {
69-
guard JSONSerialization.isValidJSONObject(responseData) == true,
69+
guard JSONSerialization.isValidJSONObject(responseData),
7070
let json = try? JSONSerialization
7171
.data(withJSONObject: responseData,
7272
options: .prettyPrinted) else {

Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public final class ParseLiveQuery: NSObject {
5454
//Task
5555
var task: URLSessionWebSocketTask! {
5656
willSet {
57-
if newValue == nil && isSocketEstablished == true {
57+
if newValue == nil && isSocketEstablished {
5858
isSocketEstablished = false
5959
}
6060
}
@@ -79,7 +79,7 @@ Not attempting to open ParseLiveQuery socket anymore
7979
}
8080
var isDisconnectedByUser = false {
8181
willSet {
82-
if newValue == true {
82+
if newValue {
8383
isConnected = false
8484
}
8585
}
@@ -110,7 +110,7 @@ Not attempting to open ParseLiveQuery socket anymore
110110
/// True if the connection to the url is up and available. False otherwise.
111111
public internal(set) var isSocketEstablished = false { //URLSession has an established socket
112112
willSet {
113-
if newValue == false {
113+
if !newValue {
114114
isConnected = newValue
115115
}
116116
}

Sources/ParseSwift/Objects/ParseUser.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ extension ParseUser {
10741074
}
10751075
var mutableSelf = self
10761076
if let currentUser = Self.current,
1077-
currentUser.hasSameObjectId(as: mutableSelf) == true {
1077+
currentUser.hasSameObjectId(as: mutableSelf) {
10781078
#if !os(Linux) && !os(Android) && !os(Windows)
10791079
// swiftlint:disable:next line_length
10801080
if let currentUserContainerInKeychain: CurrentUserContainer<BaseParseUser> = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser),
@@ -1103,7 +1103,7 @@ extension ParseUser {
11031103
}
11041104
var mutableSelf = self
11051105
if let currentUser = Self.current,
1106-
currentUser.hasSameObjectId(as: mutableSelf) == true {
1106+
currentUser.hasSameObjectId(as: mutableSelf) {
11071107
#if !os(Linux) && !os(Android) && !os(Windows)
11081108
// swiftlint:disable:next line_length
11091109
if let currentUserContainerInKeychain: CurrentUserContainer<BaseParseUser> = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser),

Sources/ParseSwift/Parse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public struct ParseSwift {
354354
#if !os(Linux) && !os(Android) && !os(Windows)
355355
// Clear items out of the Keychain on app first run.
356356
if UserDefaults.standard.object(forKey: ParseConstants.bundlePrefix) == nil {
357-
if Self.configuration.isDeletingKeychainIfNeeded == true {
357+
if Self.configuration.isDeletingKeychainIfNeeded {
358358
try? KeychainStore.old.deleteAll()
359359
try? KeychainStore.shared.deleteAll()
360360
}

Sources/ParseSwift/Types/ParseError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ public extension Error {
473473
*/
474474
func containedIn(_ errorCodes: [ParseError.Code]) -> ParseError? {
475475
guard let error = self as? ParseError,
476-
errorCodes.contains(error.code) == true else {
476+
errorCodes.contains(error.code) else {
477477
return nil
478478
}
479479
return error

0 commit comments

Comments
 (0)