From 82a61626543aeb278e0d50135dac4993b7179051 Mon Sep 17 00:00:00 2001 From: SkylerGodfrey <152727792+SkylerGodfrey@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:35:24 -0500 Subject: [PATCH] Update NetworkAuthManager.swift Made data call non-optional to address swiftLint error Non-optional String -> Data Conversion. --- Source/Networking/NetworkAuthManager.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Networking/NetworkAuthManager.swift b/Source/Networking/NetworkAuthManager.swift index b45f74b..3e43b02 100644 --- a/Source/Networking/NetworkAuthManager.swift +++ b/Source/Networking/NetworkAuthManager.swift @@ -121,11 +121,9 @@ actor NetworkAuthManager { /// - Returns: The encoded data string for use with Basic Auth. nonisolated func basicAuthString() throws -> String { guard case .basicAuth(let username, let password) = authInfo, - !username.isEmpty && !password.isEmpty, - let result = "\(username):\(password)".data(using: .utf8)?.base64EncodedString(), - !result.isEmpty else { + !username.isEmpty && !password.isEmpty else { throw AuthError.invalidUsernamePassword } - return result + return Data("\(username):\(password)".utf8).base64EncodedString() } }