@@ -31,21 +31,28 @@ final class AllListPresenter {
3131 self . interactor = interactor
3232 self . router = router
3333 }
34+
35+ @MainActor
36+ private func fetchTvShows( at type: ListType ) {
37+ Task { @MainActor in
38+ await interactor. loadTvShows ( type: type, page: currentPage)
39+ }
40+ }
3441}
3542
3643//MARK: AllListPresenter : ViewToPresenterAllListProtocol
37- extension AllListPresenter : ViewToPresenterAllListProtocol {
44+ extension AllListPresenter : @ MainActor ViewToPresenterAllListProtocol {
3845
3946
4047 func viewDidLoad( ) {
4148 view? . setBackColorAble ( color: " backColor " )
4249 view? . setNavigationTitle ( title: " All List " )
4350 }
4451
45- func getAllList( at type: ListType ) {
52+ @ MainActor func getAllList( at type: ListType ) {
4653 listtype = type
47- interactor . loadTvShows ( type : type, page : currentPage )
48-
54+ fetchTvShows ( at : type)
55+
4956 }
5057
5158 func numberOfRowsInSection( in section: Int ) -> Int {
@@ -113,12 +120,14 @@ extension AllListPresenter : ViewToPresenterAllListProtocol {
113120 return item
114121 }
115122
116- func scrollViewDidScroll( endOfPage: Bool ) {
123+ @ MainActor func scrollViewDidScroll( endOfPage: Bool ) {
117124 guard let listtype = listtype else { return }
118125 if endOfPage {
119126 if currentPage <= totalPage {
120127 currentPage += 1
121- interactor. loadTvShows ( type: listtype , page: currentPage)
128+
129+ fetchTvShows ( at: listtype)
130+
122131 view? . relaodCollectionView ( )
123132 }
124133 }
@@ -127,8 +136,8 @@ extension AllListPresenter : ViewToPresenterAllListProtocol {
127136}
128137
129138//MARK: AllListPresenter : InteractorToPresenterAllListProtocol
130- extension AllListPresenter : @ preconcurrency InteractorToPresenterAllListProtocol {
131- @ MainActor
139+ extension AllListPresenter : InteractorToPresenterAllListProtocol {
140+
132141 func sendData( _ data: DataResult < TvShow > ) {
133142
134143
@@ -147,7 +156,7 @@ extension AllListPresenter : @preconcurrency InteractorToPresenterAllListProtoco
147156
148157 }
149158
150- @ MainActor
159+
151160 func sendError( ) {
152161
153162
0 commit comments