@@ -24,12 +24,13 @@ final class TvShowDetailPresenter {
2424
2525 func viewDidLoad( ) {
2626 view? . setBackColorAble ( color: " backColor " )
27- view? . setNavigationTitle ( title: " Detail " )
28- // view?.prepareCollectionView()
27+ view? . setNavigationTitle ( title: LocalizableUI . detailNavTitle. localized)
2928 }
3029}
3130
3231extension TvShowDetailPresenter : ViewToPresenterTvShowDetailProtocol {
32+
33+
3334 func layout( for sectionIndex: Int ) -> LayoutSource {
3435 guard let sectionType = SectionType ( rawValue: sectionIndex) else {
3536 return LayoutSourceTeamplate . none. template
@@ -57,8 +58,9 @@ extension TvShowDetailPresenter: ViewToPresenterTvShowDetailProtocol {
5758
5859 func getID( id: Int ? ) {
5960 guard let id = id else { return }
60- interactor. loadTvShowDetail ( id: id)
61- interactor. loadTvShowCasts ( id: id)
61+ Task { @MainActor in
62+ await interactor. loadData ( id: id)
63+ }
6264
6365 }
6466
@@ -88,21 +90,31 @@ extension TvShowDetailPresenter: ViewToPresenterTvShowDetailProtocol {
8890 }
8991 }
9092
91-
92-
93- func titleForSection( at section: Int ) -> (
94- title: String , sizeType: SectionSizeType ,
95- buttonType: [ TitleForSectionButtonType ] ? ) {
96- guard let sectionType = SectionType ( rawValue: section) else { return ( title: " " , sizeType: . small, buttonType: [ ] ) }
97- var item : ( title: String , sizeType: SectionSizeType , buttonType: [ TitleForSectionButtonType ] ? )
98- switch sectionType {
99- case . cast:
100- item = ( title: LocalizableUI . cast. localized, sizeType: . large, buttonType: [ ] )
101- case . season:
102- item = ( title: LocalizableUI . season. localized, sizeType: . large, buttonType: [ ] )
103- }
104- return item
93+ func titleForSection( at section: Int ) -> GenericCollectionViewKit . HeaderViewItem {
94+ let headerViewItem : HeaderViewItem
95+ guard let sectionType = SectionType ( rawValue: section)
96+ else {
97+ return . init( title: " " , sizeType: . empty)
10598 }
99+ switch sectionType {
100+ case . cast:
101+ headerViewItem = . init(
102+ title: LocalizableUI . cast. localized,
103+ icon: . init(
104+ image: . systemImage( " person.3 " ) ,
105+ tintColor: . secondary) ,
106+ sizeType: . large)
107+ case . season:
108+ headerViewItem = . init(
109+ title: LocalizableUI . season. localized,
110+ icon: . init(
111+ image: . systemImage( " film.stack " ) ,
112+ tintColor: . custom( hex: " #FFA500 " ) ) ,
113+ sizeType: . large)
114+ }
115+ return headerViewItem
116+
117+ }
106118
107119 func sectionType( at section: Int ) -> SectionType {
108120 return SectionType ( rawValue: section) ?? . cast
@@ -128,13 +140,9 @@ extension TvShowDetailPresenter: InteractorToPresenterTvShowDetailProtocol {
128140 guard let seasons = seasons else { return }
129141 seasonList = seasons. map { SeasonPresentation ( season: $0) }
130142
131- case . sendError( let error) :
132- switch error {
133- case . detailError:
134- break
135- case . castError:
136- castList = [ ]
137- }
143+ case . sendError:
144+ castList = [ ]
145+ break
138146 case . sendCast( let casts) :
139147 castList = casts. map { CastPresentation ( cast: $0) }
140148
0 commit comments