@@ -26,21 +26,7 @@ final class SettingView: BaseView {
2626 }
2727
2828 override func configure( ) {
29- collectionView. autoresizingMask = [ . flexibleWidth, . flexibleHeight]
30- collectionView. backgroundColor = . systemBackground
31- collectionView. dataSource = self
32- collectionView. delegate = self
33- collectionView. isScrollEnabled = true
34- collectionView. alwaysBounceVertical = true
35- collectionView. register (
36- SettingCell . self,
37- forCellWithReuseIdentifier: SettingCell . identifier
38- )
39- collectionView. register (
40- BKDividerFooterView . self,
41- forSupplementaryViewOfKind: BKDividerFooterView . kind,
42- withReuseIdentifier: BKDividerFooterView . identifier
43- )
29+ configureCollectionView ( )
4430 }
4531
4632 override func setupLayout( ) {
@@ -60,6 +46,7 @@ final class SettingView: BaseView {
6046
6147 func setAppVersion( _ appVersion: String ) {
6248 self . appVersion = appVersion
49+ collectionView. reloadData ( )
6350 }
6451}
6552
@@ -90,11 +77,12 @@ private extension SettingView {
9077 }
9178
9279 func configureCollectionView( ) {
80+ collectionView. autoresizingMask = [ . flexibleWidth, . flexibleHeight]
9381 collectionView. backgroundColor = . systemBackground
94- collectionView. dataSource = self
95- collectionView. delegate = self
82+ collectionView. dataSource = self
83+ collectionView. delegate = self
84+ collectionView. isScrollEnabled = true
9685 collectionView. alwaysBounceVertical = true
97-
9886 collectionView. register (
9987 SettingCell . self,
10088 forCellWithReuseIdentifier: SettingCell . identifier
@@ -112,10 +100,10 @@ extension SettingView: UICollectionViewDelegate {
112100 _ collectionView: UICollectionView ,
113101 didSelectItemAt indexPath: IndexPath
114102 ) {
115- if indexPath. section == 1 {
116- if indexPath. item == 0 {
103+ if indexPath. section == Section . bottom . rawValue {
104+ if indexPath. item == Section . top . rawValue {
117105 eventPublisher. send ( . logoutButtonTapped)
118- } else if indexPath. item == 1 {
106+ } else if indexPath. item == Section . bottom . rawValue {
119107 eventPublisher. send ( . withdrawalButtonTapped)
120108 }
121109 }
@@ -144,7 +132,9 @@ extension SettingView: UICollectionViewDataSource {
144132 _ collectionView: UICollectionView ,
145133 numberOfItemsInSection section: Int
146134 ) -> Int {
147- return section == 0 ? firstMenus. count : secondMenus. count
135+ return section == Section . top. rawValue
136+ ? firstMenus. count
137+ : secondMenus. count
148138 }
149139
150140 func collectionView(
@@ -158,14 +148,14 @@ extension SettingView: UICollectionViewDataSource {
158148 return UICollectionViewCell ( )
159149 }
160150
161- let title : String = indexPath. section == 0
151+ let title : String = indexPath. section == Section . top . rawValue
162152 ? firstMenus [ indexPath. item] . title
163153 : secondMenus [ indexPath. item] . title
164154
165155 switch ( indexPath. section, indexPath. item) {
166- case ( 0 , 3 ) :
156+ case ( Section . top . rawValue , FirstMenuItem . allCases . count - 1 ) :
167157 cell. configure ( title: title, style: . label, appVersion: appVersion)
168- case ( 1 , _) :
158+ case ( Section . bottom . rawValue , _) :
169159 cell. configure ( title: title, style: . none)
170160 default :
171161 cell. configure ( title: title, style: . chevron)
0 commit comments