From 6d64831d3d0c95b6b27222d03104f7b26a2f93ac Mon Sep 17 00:00:00 2001 From: MadsBogeskov Date: Thu, 22 Feb 2024 14:47:46 +0100 Subject: [PATCH] :sparkles: Supporting new concurrency model --- .../API Request Factory/Models/APIRequest+Swiftable.swift | 2 +- Sources/SwaggerSwiftCore/Static Files/ServiceErrorFile.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SwaggerSwiftCore/API Request Factory/Models/APIRequest+Swiftable.swift b/Sources/SwaggerSwiftCore/API Request Factory/Models/APIRequest+Swiftable.swift index d075c10..fd4babe 100644 --- a/Sources/SwaggerSwiftCore/API Request Factory/Models/APIRequest+Swiftable.swift +++ b/Sources/SwaggerSwiftCore/API Request Factory/Models/APIRequest+Swiftable.swift @@ -238,7 +238,7 @@ private func _\(functionName)(\(functionArguments)) async -> \(functionReturnTyp body += "\n" body += """ - \(accessControl) func \(functionName)(\(functionArguments)\(functionArguments.isEmpty ? "" : ", ")completion: @escaping (\(functionReturnType)) -> Void = { _ in }) { + \(accessControl) func \(functionName)(\(functionArguments)\(functionArguments.isEmpty ? "" : ", ")completion: @Sendable @escaping (\(functionReturnType)) -> Void = { _ in }) { _Concurrency.Task { let result = await _\(functionName)(\(parameters.map { "\($0.name.variableNameFormatted): \($0.name.variableNameFormatted)" }.joined(separator: ", "))) completion(result) diff --git a/Sources/SwaggerSwiftCore/Static Files/ServiceErrorFile.swift b/Sources/SwaggerSwiftCore/Static Files/ServiceErrorFile.swift index b9f7ce3..7ccbc86 100644 --- a/Sources/SwaggerSwiftCore/Static Files/ServiceErrorFile.swift +++ b/Sources/SwaggerSwiftCore/Static Files/ServiceErrorFile.swift @@ -1,5 +1,5 @@ let serviceError = """ - enum ServiceError: Error { + enum ServiceError: Error { // The request failed, e.g. timeout case requestFailed(error: Error) // The backend returned an error, e.g. a 500 Internal Server Error, 403 Unauthorized