Skip to content

Commit 5eebe3d

Browse files
committed
Use @mainactor for getReleaseInfo
1 parent 1d60c54 commit 5eebe3d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/ETDistribution.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public final class ETDistribution: NSObject {
8888
return components.url
8989
}
9090

91-
public func getReleaseInfo(releaseId: String, completion: @escaping (@Sendable (Result<DistributionReleaseInfo, Error>) -> Void)) {
91+
public func getReleaseInfo(releaseId: String, completion: @escaping (@MainActor (Result<DistributionReleaseInfo, Error>) -> Void)) {
9292
if let loginSettings = loginSettings,
9393
(loginLevel?.rawValue ?? 0) > LoginLevel.none.rawValue {
9494
Auth.getAccessToken(settings: loginSettings) { [weak self] result in
@@ -110,7 +110,9 @@ public final class ETDistribution: NSObject {
110110
}
111111
return
112112
}
113-
completion(result)
113+
DispatchQueue.main.async {
114+
completion(result)
115+
}
114116
}
115117
}
116118
}
@@ -208,7 +210,7 @@ public final class ETDistribution: NSObject {
208210

209211
private func getReleaseInfo(releaseId: String,
210212
accessToken: String? = nil,
211-
completion: @escaping @Sendable (Result<DistributionReleaseInfo, Error>) -> Void) {
213+
completion: @escaping @MainActor (Result<DistributionReleaseInfo, Error>) -> Void) {
212214
guard var components = URLComponents(string: "https://api.emergetools.com/distribution/getRelease") else {
213215
fatalError("Invalid URL")
214216
}

0 commit comments

Comments
 (0)