File tree Expand file tree Collapse file tree 4 files changed +26
-22
lines changed
Expand file tree Collapse file tree 4 files changed +26
-22
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // BaseCollectionViewCell.swift
3+ // Base
4+ //
5+ // Created by ttozzi on 8/10/25.
6+ //
7+
8+ import Combine
9+ import UIKit
10+
11+ open class BaseCollectionViewCell : UICollectionViewCell {
12+
13+ public var cancellables = Set < AnyCancellable > ( )
14+
15+ open override func prepareForReuse( ) {
16+ super. prepareForReuse ( )
17+ cancellables. removeAll ( )
18+ }
19+ }
Original file line number Diff line number Diff line change 55// Created by ttozzi on 7/31/25.
66//
77
8+ import Base
89import Combine
910import DesignSystem
1011import SnapKit
@@ -23,7 +24,7 @@ struct HomeRecommendationCollectionViewCellModel: HomeCellModel {
2324 let state : State
2425}
2526
26- final class HomeRecommendationCollectionViewCell : UICollectionViewCell {
27+ final class HomeRecommendationCollectionViewCell : BaseCollectionViewCell {
2728
2829 private enum Constant {
2930 static let seeMoreAreaHeight : CGFloat = 43
@@ -67,7 +68,6 @@ final class HomeRecommendationCollectionViewCell: UICollectionViewCell {
6768 private var internalCancellables = Set < AnyCancellable > ( )
6869 private let buttonTapSubject = PassthroughSubject < Void , Never > ( )
6970 var butonTapPublisher : AnyPublisher < Void , Never > { buttonTapSubject. eraseToAnyPublisher ( ) }
70- var cancellables = Set < AnyCancellable > ( )
7171
7272 override init ( frame: CGRect ) {
7373 super. init ( frame: frame)
@@ -79,11 +79,6 @@ final class HomeRecommendationCollectionViewCell: UICollectionViewCell {
7979 fatalError ( " init(coder:) has not been implemented " )
8080 }
8181
82- override func prepareForReuse( ) {
83- super. prepareForReuse ( )
84- cancellables. removeAll ( )
85- }
86-
8782 private func setupUI( ) {
8883 contentView. backgroundColor = STColors . white. color
8984 contentView. layer. cornerRadius = 12
Original file line number Diff line number Diff line change 55// Created by ttozzi on 7/26/25.
66//
77
8+ import Base
89import Combine
910import DesignSystem
1011import SnapKit
@@ -19,7 +20,7 @@ struct MyProfileInfoCollectionViewCellModel {
1920 let birthTime : String
2021}
2122
22- final class MyProfileInfoCollectionViewCell : UICollectionViewCell {
23+ final class MyProfileInfoCollectionViewCell : BaseCollectionViewCell {
2324
2425 private lazy var contentStackView = UIStackView ( ) . then {
2526 $0. spacing = . zero
@@ -56,7 +57,6 @@ final class MyProfileInfoCollectionViewCell: UICollectionViewCell {
5657 private lazy var birthTimeLabel = UILabel ( ) . then {
5758 $0. style = Typography . Caption_12_B
5859 }
59- var cancellables = Set < AnyCancellable > ( )
6060
6161 override init ( frame: CGRect ) {
6262 super. init ( frame: frame)
@@ -67,12 +67,7 @@ final class MyProfileInfoCollectionViewCell: UICollectionViewCell {
6767 required init ? ( coder: NSCoder ) {
6868 fatalError ( " init(coder:) has not been implemented " )
6969 }
70-
71- override func prepareForReuse( ) {
72- super. prepareForReuse ( )
73- cancellables. removeAll ( )
74- }
75-
70+
7671 private func setupUI( ) {
7772 backgroundColor = . clear
7873 contentStackView. backgroundColor = . clear
Original file line number Diff line number Diff line change 55// Created by ttozzi on 7/31/25.
66//
77
8+ import Base
89import Combine
910import DesignSystem
1011import Extension
@@ -22,7 +23,7 @@ final class PushSettingToggleCollectionViewCellModel: PushSettingCellModel {
2223 }
2324}
2425
25- final class PushSettingToggleCollectionViewCell : UICollectionViewCell {
26+ final class PushSettingToggleCollectionViewCell : BaseCollectionViewCell {
2627
2728 private lazy var contentStackView = UIStackView ( ) . then {
2829 $0. axis = . horizontal
@@ -42,7 +43,6 @@ final class PushSettingToggleCollectionViewCell: UICollectionViewCell {
4243 } )
4344 . eraseToAnyPublisher ( )
4445 }
45- var cancellables = Set < AnyCancellable > ( )
4646
4747 override init ( frame: CGRect ) {
4848 super. init ( frame: frame)
@@ -53,11 +53,6 @@ final class PushSettingToggleCollectionViewCell: UICollectionViewCell {
5353 fatalError ( " init(coder:) has not been implemented " )
5454 }
5555
56- override func prepareForReuse( ) {
57- super. prepareForReuse ( )
58- cancellables. removeAll ( )
59- }
60-
6156 private func setupUI( ) {
6257 contentView. backgroundColor = . clear
6358
You can’t perform that action at this time.
0 commit comments