Skip to content

Commit 149bb1a

Browse files
committed
chore: #3 - Sendable 채택
1 parent cd3952e commit 149bb1a

8 files changed

Lines changed: 17 additions & 17 deletions

File tree

Projects/Modules/Networks/Sources/Base/BaseResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
struct BaseResponse<T: Decodable>: Decodable {
11+
struct BaseResponse<T: Decodable & Sendable>: Decodable, Sendable {
1212
let code: String
1313
let message: String
1414
let data: T?

Projects/Modules/Networks/Sources/Base/EmptyResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
import Foundation
1010

11-
struct EmptyResponse: Decodable {}
11+
struct EmptyResponse: Decodable, Sendable {}

Projects/Modules/Networks/Sources/Base/ErrorResponse.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
import Foundation
1010

11-
public struct ErrorResponse: Decodable {
11+
public struct ErrorResponse: Decodable, Sendable {
1212
public let code: String?
1313
public let message: String?
1414
public let errors: [ErrorDetail]?
1515

16-
public struct ErrorDetail: Decodable {
16+
public struct ErrorDetail: Decodable, Sendable {
1717
public let field: String?
1818
public let message: String?
1919
}

Projects/Modules/Networks/Sources/Base/NetworkError.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88

99
import Foundation
1010

11-
public enum NetworkError: Error {
11+
public enum NetworkError: Error, Sendable {
1212
case connectionFailed
1313
case decodingFailed
14-
case unknown(Error)
14+
case unknown(String)
1515

1616
public var message: String {
1717
switch self {
1818
case .connectionFailed:
1919
return "네트워크 연결을 확인해주세요"
2020
case .decodingFailed:
2121
return "데이터 처리 중 오류가 발생했습니다"
22-
case .unknown:
23-
return "알 수 없는 오류가 발생했습니다"
22+
case .unknown(let description):
23+
return "알 수 없는 오류: \(description)"
2424
}
2525
}
2626
}

Projects/Modules/Networks/Sources/Base/NetworkResult.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111
@frozen
12-
public enum NetworkResult<T, E: APIErrorProtocol> {
12+
public enum NetworkResult<T: Sendable, E: APIErrorProtocol & Sendable>: Sendable {
1313
case success(T)
1414
case failure(E)
1515
case networkFailure(NetworkError)

Projects/Modules/Networks/Sources/DTO/Auth/SignupDTO.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
public struct SignupRequest: Encodable {
11+
public struct SignupRequest: Encodable, Sendable {
1212
public let fcmToken: String
1313
public let deviceModel: String?
1414
public let deviceOs: String?
@@ -30,7 +30,7 @@ public struct SignupRequest: Encodable {
3030
}
3131
}
3232

33-
public struct SignupResponse: Decodable {
33+
public struct SignupResponse: Decodable, Sendable {
3434
public let uuid: String
3535
public let accessToken: String
3636
public let nickname: String

Projects/Modules/Networks/Sources/Error/Auth/SignupError.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111

12-
public enum SignupField {
12+
public enum SignupField: Sendable {
1313
case fcmToken
1414
case unknown(String)
1515

@@ -22,13 +22,13 @@ public enum SignupField {
2222
}
2323

2424
// MARK: - Error
25-
public struct SignupError: APIErrorProtocol {
25+
public struct SignupError: APIErrorProtocol, Sendable {
2626
public let type: ErrorType
2727
public let message: String
2828
public let field: SignupField?
2929
public let fieldMessage: String?
3030

31-
public enum ErrorType {
31+
public enum ErrorType: Sendable {
3232
case validationError
3333
case internalServerError
3434
case undefined(code: String)

Projects/Modules/Networks/Sources/Extensions/MoyaProvider+Async.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Moya
1212
extension MoyaProvider {
1313
private static var successCode: String { "2000" }
1414

15-
func request<T: Decodable, E: APIErrorProtocol>(
15+
func request<T: Decodable & Sendable, E: APIErrorProtocol & Sendable>(
1616
_ target: Target,
1717
errorType: E.Type
1818
) async -> NetworkResult<T, E> {
@@ -56,7 +56,7 @@ extension MoyaProvider {
5656
}
5757
}
5858

59-
func requestPlain<E: APIErrorProtocol>(
59+
func requestPlain<E: APIErrorProtocol & Sendable>(
6060
_ target: Target,
6161
errorType: E.Type
6262
) async -> NetworkResult<Void, E> {
@@ -102,7 +102,7 @@ extension MoyaProvider {
102102
where nsError.domain == NSURLErrorDomain:
103103
return .connectionFailed
104104
default:
105-
return .unknown(error)
105+
return .unknown(error.localizedDescription)
106106
}
107107
}
108108
}

0 commit comments

Comments
 (0)