-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHomeRegistration.swift
More file actions
78 lines (66 loc) · 2.98 KB
/
Copy pathHomeRegistration.swift
File metadata and controls
78 lines (66 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
// HomeRegistration.swift
// HomeFeature
//
// Created by 최안용 on 2/6/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//
import UIKit
import DSKit
extension HomeViewController {
func createBannerCellRegistration() -> UICollectionView.CellRegistration<HomeBannerCell, HomePresentationModel.Banner> {
return UICollectionView.CellRegistration { cell, indexPath, item in
cell.configure(item)
}
}
func createCategoryCellRegistration() -> UICollectionView.CellRegistration<CategoryChipCell, (HomePresentationModel.Category, Bool)> {
return UICollectionView.CellRegistration { cell, indexPath, item in
let (chip, isSelected) = item
let chipType: ChipIconType = {
switch chip.viedoType {
case .tv: ChipIconType.tv
case .youtube: ChipIconType.youtube
case .none: ChipIconType.none
}
}()
cell.configure(chipType, chip.creator, isSelected)
}
}
func createPopularTripCellRegistration() -> UICollectionView.CellRegistration<PopularInfoCell, HomePresentationModel.PopularTrip> {
return UICollectionView.CellRegistration { cell, indexPath, item in
cell.configure(
thumbnailUrl: item.thumbnailUrl,
city: item.city,
title: item.title,
nation: item.country,
schedule: item.schedule
)
}
}
func createRecommedTripCellRegistration() -> UICollectionView.CellRegistration<RecommendInfoCell, HomePresentationModel.RecommendedTrip> {
return UICollectionView.CellRegistration { cell, indexPath, item in
cell.configure(
title: item.title,
thumbnailUrl: item.thumbnailUrl,
countryCode: item.country,
creator: item.creator,
city: item.city,
schedule: item.schedule
)
}
}
func createHeaderRegistration() -> UICollectionView.SupplementaryRegistration<HomeHeaderView> {
return UICollectionView.SupplementaryRegistration<HomeHeaderView>(elementKind: UICollectionView.elementKindSectionHeader) { headerView,elementKind,indexPath in
guard let sectionKind = HomeSectionKind(rawValue: indexPath.section) else { return }
headerView.configure(title: sectionKind.headerTitle)
}
}
func createPopularFooterRegistration() -> UICollectionView.SupplementaryRegistration<HomeFooterButtonView> {
return UICollectionView.SupplementaryRegistration<HomeFooterButtonView>(elementKind: UICollectionView.elementKindSectionFooter) { [weak self] footerView,elementKind,indexPath in
guard let self = self else { return }
footerView.plusBtnTapped
.bind(to: self.moreButtonTapped)
.disposed(by: footerView.disposeBag)
}
}
}