Skip to content

Commit 49eb4ca

Browse files
committed
debug swift concurrency
1 parent 02e708e commit 49eb4ca

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

ICTMDBDetailModule/DetailInteractor.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ final class TvShowDetailInteractor : PresenterToInteractorTvShowDetailProtocol,@
3333

3434
do{
3535
let (detailResult,castResult) = try await (detail,cast)
36-
await presenter?.onHandle(handle: .sendData(detailResult))
37-
await presenter?.onHandle(handle: .sendCast(castResult.cast))
36+
await MainActor.run {
37+
presenter?.onHandle(handle: .sendData(detailResult))
38+
presenter?.onHandle(handle: .sendCast(castResult.cast))
39+
}
40+
3841
}catch{
39-
await presenter?.onHandle(handle: .sendError)
42+
await MainActor.run {
43+
presenter?.onHandle(handle: .sendError)
44+
}
45+
4046
}
4147

4248
}

ICTMDBDetailModule/DetailPresenter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extension TvShowDetailPresenter: ViewToPresenterTvShowDetailProtocol {
5858

5959
func getID(id: Int?) {
6060
guard let id = id else {return}
61-
Task{@MainActor in
61+
Task {
6262
await interactor.loadData(id: id)
6363
}
6464

0 commit comments

Comments
 (0)