Skip to content

Commit df222ee

Browse files
committed
add Sendable
1 parent 78a4b42 commit df222ee

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

Sources/EverscaleClientSwift/Binding/Binding.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ public final class TSDKBindingModule: TSDKBindingPrtcl {
9595

9696
public func requestLibraryAsync(_ methodName: String,
9797
_ payload: Encodable = "",
98-
_ requestHandler: @escaping (_ requestId: UInt32,
99-
_ stringResponse: String,
100-
_ responseType: TSDKBindingResponseType,
101-
_ finished: Bool) throws -> Void
98+
_ requestHandler: @escaping @Sendable (_ requestId: UInt32,
99+
_ stringResponse: String,
100+
_ responseType: TSDKBindingResponseType,
101+
_ finished: Bool) throws -> Void
102102
) throws {
103103
try convertToTSDKString(methodName) { tsdkMethodName in
104104
let payload = payload.toJson() ?? ""
@@ -138,10 +138,10 @@ public final class TSDKBindingModule: TSDKBindingPrtcl {
138138

139139
public func requestLibraryAsyncAwait(_ methodName: String,
140140
_ payload: Encodable = "",
141-
_ requestHandler: @escaping (_ requestId: UInt32,
142-
_ stringResponse: String,
143-
_ responseType: TSDKBindingResponseType,
144-
_ finished: Bool) throws -> Void
141+
_ requestHandler: @escaping @Sendable (_ requestId: UInt32,
142+
_ stringResponse: String,
143+
_ responseType: TSDKBindingResponseType,
144+
_ finished: Bool) throws -> Void
145145
) throws {
146146
try convertToTSDKString(methodName) { tsdkMethodName in
147147
let payload = payload.toJson() ?? ""
@@ -172,7 +172,7 @@ public final class TSDKBindingModule: TSDKBindingPrtcl {
172172
let response: BindingStore.RawResponse = try BindingStore.getCompleteResponse(requestId)
173173
try responseHandler?(response.requestId, response.stringResponse, response.responseType, response.finished)
174174
BindingStore.deleteCompleteResponse(requestId)
175-
}
175+
}
176176
} catch {
177177
BindingStore.deleteResponseHandler(requestId)
178178
BindingStore.deleteCompleteResponse(requestId)

Sources/EverscaleClientSwift/Binding/BindingStore.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
import Foundation
99

1010
public final class BindingStore {
11-
11+
1212
private static var requsetId: UInt32 = .init()
1313
private static let requestLock: NSLock = .init()
1414
private static let asyncResponseLock: NSLock = .init()
1515
public static var responses: [UInt32: (_ requestId: UInt32,
1616
_ stringResponse: String,
1717
_ responseType: TSDKBindingResponseType,
1818
_ finished: Bool) throws -> Void] = .init()
19-
19+
2020
/// BECAUSE SDK METHODS LIKE PROCESS MESSAGE RETURNED TWO RESPONSE
2121
/// FIRST REAL RESPONSE AND LAST EMPTY STRING WITH STATUS FINISHED
2222
public typealias RawResponse = (requestId: UInt32,
@@ -44,18 +44,18 @@ public final class BindingStore {
4444
defer { completeResponsesLock.unlock() }
4545
completeResponses[id] = nil
4646
}
47-
47+
4848
public class func addResponseHandler(_ requestId: UInt32,
49-
_ response: @escaping (_ requestId: UInt32,
50-
_ stringResponse: String,
51-
_ responseType: TSDKBindingResponseType,
52-
_ finished: Bool) throws -> Void
49+
_ response: @escaping @Sendable (_ requestId: UInt32,
50+
_ stringResponse: String,
51+
_ responseType: TSDKBindingResponseType,
52+
_ finished: Bool) throws -> Void
5353
) {
5454
asyncResponseLock.lock()
5555
responses[requestId] = response
5656
asyncResponseLock.unlock()
5757
}
58-
58+
5959
public class func getResponseHandler(_ requestId: UInt32) -> ((_ requestId: UInt32,
6060
_ stringResponse: String,
6161
_ responseType: TSDKBindingResponseType,
@@ -64,13 +64,13 @@ public final class BindingStore {
6464
defer { asyncResponseLock.unlock() }
6565
return responses[requestId]
6666
}
67-
67+
6868
public class func deleteResponseHandler(_ requestId: UInt32) {
6969
asyncResponseLock.lock()
7070
defer { asyncResponseLock.unlock() }
7171
responses[requestId] = nil
7272
}
73-
73+
7474
public class func generate_request_id() -> UInt32 {
7575
requestLock.lock()
7676
defer { requestLock.unlock() }

0 commit comments

Comments
 (0)