Skip to content

Commit dd9e119

Browse files
chore: update to use guards
1 parent 5a72536 commit dd9e119

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

FirebaseSwiftUI/FirebaseOAuthSwiftUI/Sources/Services/OAuthProviderSwift.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,23 @@ public class OAuthProviderSwift: AuthProviderSwift, DeleteUserSwift {
9696

9797
return try await withCheckedThrowingContinuation { continuation in
9898
provider.getCredentialWith(nil) { credential, error in
99-
if let error {
99+
if let error = error {
100100
continuation.resume(
101101
throwing: AuthServiceError.signInFailed(underlying: error)
102102
)
103-
} else if let credential {
104-
continuation.resume(returning: credential)
105-
} else {
103+
return
104+
}
105+
106+
guard let credential = credential else {
106107
continuation.resume(
107108
throwing: AuthServiceError.invalidCredentials(
108109
"\(self.providerId) did not provide a valid AuthCredential"
109110
)
110111
)
112+
return
111113
}
114+
115+
continuation.resume(returning: credential)
112116
}
113117
}
114118
}

0 commit comments

Comments
 (0)