From 1c723f15b648477e6949fad89fd1e0f5d3de9f77 Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sat, 27 Jan 2024 00:01:48 +0900 Subject: [PATCH 01/14] =?UTF-8?q?Update:=20profile=20url=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 비율이 다른 이미지 링크로 변경 --- .../Falling/FallingTarget+SampleData.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Projects/Data/Src/Repository/Falling/FallingTarget+SampleData.swift b/Projects/Data/Src/Repository/Falling/FallingTarget+SampleData.swift index af6df267..fa24e498 100644 --- a/Projects/Data/Src/Repository/Falling/FallingTarget+SampleData.swift +++ b/Projects/Data/Src/Repository/Falling/FallingTarget+SampleData.swift @@ -59,11 +59,11 @@ extension FallingTarget { ], "userProfilePhotos": [ { - "url": "test1", + "url": "https://cdn.pixabay.com/photo/2024/01/15/21/16/dog-8510901_640.jpg", "priority": 1 }, { - "url": "https://firebasestorage.googleapis.com/v0/b/tht-falling.appspot.com/o/images%2Fprofile_example2.png?alt=media&token=e19493ed-10ba-4784-bf94-f4b99af84161", + "url": "https://firebasestorage.googleapis.com/v0/b/tht-falling.appspot.com/o/images%2Fprofile_example1.png?alt=media&token=dc28c0cd-98b2-4332-9660-35530283d77c", "priority": 2 }, { @@ -116,11 +116,11 @@ extension FallingTarget { ], "userProfilePhotos": [ { - "url": "https://firebasestorage.googleapis.com/v0/b/tht-falling.appspot.com/o/images%2Fprofile_example1 .png?alt=media&token=dc28c0cd-98b2-4332-9660-35530283d77c", + "url": "https://cdn.pixabay.com/photo/2023/05/07/11/57/surfboard-7976219_960_720.jpg", "priority": 1 }, { - "url": "https://firebasestorage.googleapis.com/v0/b/tht-falling.appspot.com/o/images%2Fprofile_example2.png?alt=media&token=e19493ed-10ba-4784-bf94-f4b99af84161", + "url": "https://cdn.pixabay.com/photo/2024/01/07/11/17/welsh-corgi-8492879_640.jpg", "priority": 2 }, { @@ -173,11 +173,11 @@ extension FallingTarget { ], "userProfilePhotos": [ { - "url": "https://firebasestorage.googleapis.com/v0/b/tht-falling.appspot.com/o/images%2Fprofile_example1.png?alt=media&token=dc28c0cd-98b2-4332-9660-35530283d77c", + "url": "https://cdn.pixabay.com/photo/2023/03/18/05/26/ferris-wheel-7859855_640.jpg", "priority": 1 }, { - "url": "https://firebasestorage.googleapis.com/v0/b/tht-falling.appspot.com/o/images%2Fprofile_example2.png?alt=media&token=e19493ed-10ba-4784-bf94-f4b99af84161", + "url": "https://cdn.pixabay.com/photo/2023/11/17/12/46/cat-8394224_640.jpg", "priority": 2 }, { From f4f50ccd640134cf2b556bb4207646170dfc7259 Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sat, 27 Jan 2024 00:05:34 +0900 Subject: [PATCH 02/14] =?UTF-8?q?[#43]Recator:=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EC=A7=80=EC=85=94=EB=84=90=20=EB=A0=88=EC=9D=B4=EC=95=84?= =?UTF-8?q?=EC=9B=83=EC=9C=BC=EB=A1=9C=20=EB=A7=88=EC=9D=B4=EA=B7=B8?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - UICollectionViewCompositionalLayout 확장 - 제약조건 변경 - 필요없는 코드 삭제 --- .../Falling/Src/Home/FallingHomeView.swift | 71 +++++++++++++++++-- 1 file changed, 67 insertions(+), 4 deletions(-) diff --git a/Projects/Features/Falling/Src/Home/FallingHomeView.swift b/Projects/Features/Falling/Src/Home/FallingHomeView.swift index 22161e64..55856a85 100644 --- a/Projects/Features/Falling/Src/Home/FallingHomeView.swift +++ b/Projects/Features/Falling/Src/Home/FallingHomeView.swift @@ -12,9 +12,7 @@ import DSKit final class FallingHomeView: TFBaseView { lazy var collectionView: UICollectionView = { - let flowLayout = UICollectionViewFlowLayout() - flowLayout.minimumLineSpacing = 14 - flowLayout.scrollDirection = .vertical + let flowLayout = UICollectionViewCompositionalLayout.verticalListLayout(withEstimatedHeight: ((UIWindow.keyWindow?.frame.width ?? 0) - 32) * 1.64) let collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout) collectionView.isScrollEnabled = false @@ -23,11 +21,76 @@ final class FallingHomeView: TFBaseView { }() override func makeUI() { + self.backgroundColor = DSKitAsset.Color.neutral700.color + self.addSubview(collectionView) self.collectionView.snp.makeConstraints { - $0.top.equalToSuperview().inset(8) + $0.top.equalTo(self.safeAreaLayoutGuide).inset(8) $0.leading.bottom.trailing.equalToSuperview() } } } + +extension UICollectionViewCompositionalLayout { + static func verticalListLayout(withEstimatedHeight estimatedHeight: CGFloat = 110) -> UICollectionViewCompositionalLayout { + return UICollectionViewCompositionalLayout(section: .verticalListSection(withEstimatedHeight: estimatedHeight)) + } + + static func horizontalListLayout() -> UICollectionViewCompositionalLayout { + return UICollectionViewCompositionalLayout(section: .horizontalListSection()) + } +} + +extension NSCollectionLayoutSection { + static func verticalListSection(withEstimatedHeight estimatedHeight: CGFloat = 110) -> NSCollectionLayoutSection { + let itemSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1.0), + heightDimension: .fractionalHeight(1.0) + ) + let layoutItem = NSCollectionLayoutItem(layoutSize: itemSize) + + let layoutGroupSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1.0), + heightDimension: .estimated(estimatedHeight) + ) + + let layoutGroup = NSCollectionLayoutGroup.vertical( + layoutSize: layoutGroupSize, + subitems: [layoutItem] + ) + + let section = NSCollectionLayoutSection(group: layoutGroup) + section.contentInsets = NSDirectionalEdgeInsets( + top: 0, + leading: 16, + bottom: 0, + trailing: 16 + ) + section.interGroupSpacing = 14 + return section + } + + static func horizontalListSection() -> NSCollectionLayoutSection { + let itemSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1.0), + heightDimension: .fractionalHeight(1.0) + ) + let layoutItem = NSCollectionLayoutItem(layoutSize: itemSize) + + let layoutGroupSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1.0), + heightDimension: .fractionalHeight(1.0) + ) + + let layoutGroup = NSCollectionLayoutGroup.horizontal( + layoutSize: layoutGroupSize, + subitems: [layoutItem] + ) + + let section = NSCollectionLayoutSection(group: layoutGroup) + section.orthogonalScrollingBehavior = .paging + + return section + } +} From bc73245b52603e913ee8e876897152bee12a3768 Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sat, 27 Jan 2024 00:06:29 +0900 Subject: [PATCH 03/14] =?UTF-8?q?[#43]Refactor:=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EC=A7=80=EC=85=94=EB=84=90=20=EB=A0=88=EC=9D=B4=EC=95=84?= =?UTF-8?q?=EC=9B=83=EC=9C=BC=EB=A1=9C=20=EB=A7=88=EC=9D=B4=EA=B7=B8?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - collection view delegate 코드 삭제 --- .../Src/Home/FallingHomeViewController.swift | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/Projects/Features/Falling/Src/Home/FallingHomeViewController.swift b/Projects/Features/Falling/Src/Home/FallingHomeViewController.swift index 147327f7..b118ab35 100644 --- a/Projects/Features/Falling/Src/Home/FallingHomeViewController.swift +++ b/Projects/Features/Falling/Src/Home/FallingHomeViewController.swift @@ -19,7 +19,6 @@ final class FallingHomeViewController: TFBaseViewController { init(viewModel: FallingHomeViewModel) { self.viewModel = viewModel super.init(nibName: nil, bundle: nil) - setupDelegate() } required init?(coder: NSCoder) { @@ -57,7 +56,7 @@ final class FallingHomeViewController: TFBaseViewController { .when(.recognized) .withLatestFrom(timerActiveRelay) { !$1 } .asDriverOnErrorJustEmpty() - + cardDoubleTapTrigger .drive(timerActiveRelay) .disposed(by: disposeBag) @@ -67,16 +66,17 @@ final class FallingHomeViewController: TFBaseViewController { .disposed(by: disposeBag) let input = FallingHomeViewModel.Input(initialTrigger: initialTrigger, - timeOverTrigger: timerOverTrigger) + timeOverTrigger: timerOverTrigger) let output = viewModel.transform(input: input) var usersCount = 0 let profileCellRegistration = UICollectionView.CellRegistration { [weak self] cell, indexPath, item in - - let observer = FallingUserCollectionViewCellObserver(userCardScrollIndex: output.userCardScrollIndex.asObservable(), - timerActiveTrigger: timerActiveRelay.asObservable()) + let observer = FallingUserCollectionViewCellObserver( + userCardScrollIndex: output.userCardScrollIndex.asObservable(), + timerActiveTrigger: timerActiveRelay.asObservable() + ) cell.bind(model: item) cell.bind(observer, @@ -97,7 +97,7 @@ final class FallingHomeViewController: TFBaseViewController { snapshot.appendItems(list) this.dataSource.apply(snapshot) }).disposed(by: disposeBag) - + output.userCardScrollIndex .drive(with: self, onNext: { this, index in if usersCount == 0 { return } @@ -109,17 +109,6 @@ final class FallingHomeViewController: TFBaseViewController { }) .disposed(by: self.disposeBag) } - - private func setupDelegate() { - homeView.collectionView.delegate = self - } -} - -extension FallingHomeViewController: UICollectionViewDelegateFlowLayout { - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - return CGSize(width: view.frame.width - 32, - height: (view.frame.width - 32) * 1.64) - } } extension FallingHomeViewController: TimeOverDelegate { @@ -141,9 +130,9 @@ extension Reactive where Base: FallingHomeViewController { // static var previews: some View { // let service = FallingAPI(isStub: true, sampleStatusCode: 200, customEndpointClosure: nil) // let navigator = MainNavigator(controller: UINavigationController(), fallingService: service) -// +// // let viewModel = MainViewModel(navigator: navigator, service: service) -// +// // return FallingHomeViewController(viewModel: viewModel) // .toPreView() // } From 48740fa775d39717094409147cc6221592dff729 Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sat, 27 Jan 2024 00:11:17 +0900 Subject: [PATCH 04/14] =?UTF-8?q?Update:=20=EC=BD=94=EB=84=88=20=EB=9D=BC?= =?UTF-8?q?=EB=94=94=EC=96=B4=EC=8A=A4=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 제약 조건 부분 변경 --- .../Cell/FallingUserCollectionViewCell.swift | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift b/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift index f5aa029c..34655a3a 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift @@ -29,20 +29,18 @@ final class FallingUserCollectionViewCell: TFBaseCollectionViewCell { lazy var cardTimeView = CardTimeView() - override func layoutSubviews() { - self.backgroundColor = .systemGray - } - override func makeUI() { - self.contentView.addSubviews([profileCarouselView, cardTimeView]) + self.layer.cornerRadius = 20 + + self.contentView.addSubview(profileCarouselView) + self.profileCarouselView.addSubview(cardTimeView) self.profileCarouselView.snp.makeConstraints { $0.edges.equalToSuperview() } self.cardTimeView.snp.makeConstraints { - $0.top.equalTo(self.safeAreaLayoutGuide).inset(12) - $0.leading.trailing.equalToSuperview().inset(12) + $0.top.leading.trailing.equalToSuperview().inset(12) $0.height.equalTo(32) } } @@ -50,7 +48,7 @@ final class FallingUserCollectionViewCell: TFBaseCollectionViewCell { override func prepareForReuse() { super.prepareForReuse() disposeBag = DisposeBag() -// profileCarouselView.tagCollectionView.isHidden = true + // profileCarouselView.tagCollectionView.isHidden = true } func bind(model: FallingUser) { @@ -69,9 +67,7 @@ final class FallingUserCollectionViewCell: TFBaseCollectionViewCell { if index.row == userCardScrollIndex { self.profileCarouselView.hiddenDimView() return observer.timerActiveTrigger -// return timerActiveTrigger } -// else { return false } else { return Observable.just(false) } }.map { $0 } .flatMapLatest { return $0 } @@ -90,12 +86,12 @@ final class FallingUserCollectionViewCell: TFBaseCollectionViewCell { .drive() .disposed(by: self.disposeBag) -// profileCarouselView.infoButton.rx.tap.asDriver() -// .scan(true) { lastValue, _ in -// return !lastValue -// } -// .drive(profileCarouselView.tagCollectionView.rx.isHidden) -// .disposed(by: disposeBag) + profileCarouselView.infoButton.rx.tap.asDriver() + .scan(true) { lastValue, _ in + return !lastValue + } + .drive(profileCarouselView.tagCollectionView.rx.isHidden) + .disposed(by: disposeBag) } func dotPosition(progress: Double, rect: CGRect) -> CGPoint { @@ -121,11 +117,11 @@ extension Reactive where Base: FallingUserCollectionViewCell { var timeState: Binder { return Binder(self.base) { (base, timeState) in base.cardTimeView.timerView.trackLayer.strokeColor = timeState.fillColor.color.cgColor - base.cardTimeView.timerView.strokeLayer.strokeColor = timeState.color.color.cgColor - base.cardTimeView.timerView.dotLayer.strokeColor = timeState.color.color.cgColor - base.cardTimeView.timerView.dotLayer.fillColor = timeState.color.color.cgColor - base.cardTimeView.timerView.timerLabel.textColor = timeState.color.color - base.cardTimeView.progressView.progressBarColor = timeState.color.color + base.cardTimeView.timerView.strokeLayer.strokeColor = timeState.timerTintColor.color.cgColor + base.cardTimeView.timerView.dotLayer.strokeColor = timeState.timerTintColor.color.cgColor + base.cardTimeView.timerView.dotLayer.fillColor = timeState.timerTintColor.color.cgColor + base.cardTimeView.timerView.timerLabel.textColor = timeState.timerTintColor.color + base.cardTimeView.progressView.progressBarColor = timeState.progressBarColor.color base.cardTimeView.timerView.dotLayer.isHidden = timeState.isDotHidden From 45b09b9176f48f7c063cc41a498a0618fe7e22e8 Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sat, 27 Jan 2024 00:12:34 +0900 Subject: [PATCH 05/14] =?UTF-8?q?Update:=20=EB=94=94=EC=9E=90=EC=9D=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 원래 타이머 뷰 텍스트, stroke, progress bar 색상이 동일하게 변화했지만 일부 변경되어 따로 변수 생성 --- .../FallinguserCollectionViewCellModel.swift | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Projects/Features/Falling/Src/Subviews/Cell/FallinguserCollectionViewCellModel.swift b/Projects/Features/Falling/Src/Subviews/Cell/FallinguserCollectionViewCellModel.swift index e5efa7ca..a97d0a3a 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/FallinguserCollectionViewCellModel.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/FallinguserCollectionViewCellModel.swift @@ -42,7 +42,7 @@ enum TimeState { } } - var color: DSKitColors { + var timerTintColor: DSKitColors { switch self { case .zero, .five: return DSKitAsset.Color.primary500 @@ -59,6 +59,23 @@ enum TimeState { } } + var progressBarColor: DSKitColors { + switch self { + case .five: + return DSKitAsset.Color.primary500 + case .four: + return DSKitAsset.Color.thtOrange100 + case .three: + return DSKitAsset.Color.thtOrange200 + case .two: + return DSKitAsset.Color.thtOrange300 + case .one: + return DSKitAsset.Color.thtRed + default: + return DSKitAsset.Color.neutral600 + } + } + var isDotHidden: Bool { switch self { case .initial, .over: From 4edc82e8b6b031400635bb927310828d1f36508e Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sat, 27 Jan 2024 00:14:25 +0900 Subject: [PATCH 06/14] =?UTF-8?q?Update:=20image=20view=20content=20mode?= =?UTF-8?q?=20scaleAspectFit=20->=20scaleToFill=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 테스트 이미지에서 바인딩된 이미지 kf로 할당 --- .../Src/Subviews/Cell/ProfileCollectionViewCell.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Projects/Features/Falling/Src/Subviews/Cell/ProfileCollectionViewCell.swift b/Projects/Features/Falling/Src/Subviews/Cell/ProfileCollectionViewCell.swift index 84cf8709..3fea4a04 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/ProfileCollectionViewCell.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/ProfileCollectionViewCell.swift @@ -13,7 +13,7 @@ import DSKit final class ProfileCollectionViewCell: UICollectionViewCell { private lazy var imageView: UIImageView = { let imageView = UIImageView() - imageView.contentMode = .scaleAspectFit + imageView.contentMode = .scaleToFill imageView.layer.masksToBounds = true return imageView }() @@ -46,13 +46,7 @@ final class ProfileCollectionViewCell: UICollectionViewCell { guard let url = URL(string: imageURL) else { return } - let random: [DSKitImages] = [DSKitAsset.Image.Test.test1, DSKitAsset.Image.Test.test2] - self.imageView.image = random.randomElement()?.image - -// self.imageView.setResource(url) { [weak self] in -// self?.imageView.sizeToFit() -// self?.imageView.layoutIfNeeded() -// } + self.imageView.kf.setImage(with: url) } } From 1fe4ab135fb8581e43328f1319da5c32e17ebd9e Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sat, 27 Jan 2024 00:16:02 +0900 Subject: [PATCH 07/14] =?UTF-8?q?[#43]Refactor:=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EC=A7=80=EC=85=94=EB=84=90=20=EB=A0=88=EC=9D=B4=EC=95=84?= =?UTF-8?q?=EC=9B=83=EC=9C=BC=EB=A1=9C=20=EB=A7=88=EC=9D=B4=EA=B7=B8?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - data source 정의 및 설정 코드 추가 - 전달받은 데이터 differable datasource로 바인딩 --- .../Src/Subviews/ProfileCarouselView.swift | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/Projects/Features/Falling/Src/Subviews/ProfileCarouselView.swift b/Projects/Features/Falling/Src/Subviews/ProfileCarouselView.swift index 83f1365d..f98ecbf7 100644 --- a/Projects/Features/Falling/Src/Subviews/ProfileCarouselView.swift +++ b/Projects/Features/Falling/Src/Subviews/ProfileCarouselView.swift @@ -12,6 +12,8 @@ import FallingInterface import Domain final class ProfileCarouselView: TFBaseView { + private var dataSource: UICollectionViewDiffableDataSource! + var photos: [UserProfilePhoto] = [] { didSet { pageControl.currentPage = 0 @@ -30,18 +32,15 @@ final class ProfileCarouselView: TFBaseView { }() lazy var collectionView: UICollectionView = { - let layout = UICollectionViewFlowLayout() - layout.scrollDirection = .horizontal - layout.minimumLineSpacing = 0 + let layout = UICollectionViewCompositionalLayout.horizontalListLayout() - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) - collectionView.showsVerticalScrollIndicator = false - collectionView.showsHorizontalScrollIndicator = false - collectionView.dataSource = self - collectionView.delegate = self - collectionView.register(cellType: ProfileCollectionViewCell.self) - collectionView.isPagingEnabled = true - collectionView.backgroundColor = DSKitAsset.Color.neutral50.color + let collectionView = UICollectionView( + frame: .zero, + collectionViewLayout: layout + ) + collectionView.isScrollEnabled = false + collectionView.backgroundColor = DSKitAsset.Color.neutral700.color + collectionView.layer.cornerRadius = 20 return collectionView }() @@ -149,6 +148,8 @@ final class ProfileCarouselView: TFBaseView { y: 0, width: (UIWindow.keyWindow?.frame.width ?? 0) - 32, height: UIWindow.keyWindow?.frame.height ?? 0)) + + configureDataSource() } func bind(_ viewModel: FallingUser) { @@ -160,22 +161,23 @@ final class ProfileCarouselView: TFBaseView { ProfileInfoSection(header: "흥미", items: viewModel.interestResponses), ProfileInfoSection(header: "자기소개", introduce: viewModel.introduction) ] + + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.profile]) + snapshot.appendItems(viewModel.userProfilePhotos) + self.dataSource.apply(snapshot) } } -extension ProfileCarouselView: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - return self.bounds.size - } - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return photos.count - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCell(for: indexPath, cellType: ProfileCollectionViewCell.self) - let item = photos[indexPath.item] - cell.bind(imageURL: item.url) - return cell +extension ProfileCarouselView { + func configureDataSource() { + let profileCellRegistration = UICollectionView.CellRegistration { cell, indexPath, item in + cell.bind(imageURL: item.url) + } + + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView, cellProvider: { collectionView, indexPath, itemIdentifier in + return collectionView.dequeueConfiguredReusableCell(using: profileCellRegistration, for: indexPath, item: itemIdentifier) + }) } } From 8d7df715d734d0eb11e4ec02fa389557e1c33b23 Mon Sep 17 00:00:00 2001 From: kangho lee Date: Sat, 27 Jan 2024 19:29:02 +0900 Subject: [PATCH 08/14] =?UTF-8?q?Refactor:=20Falling=20Card=20Stream=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Stream 전달 delegate에서 Observer로 변경 2. VC 로직 VM으로 이동 3. Diffable 관련 type typealias로 관리, 추후 Generic, human error 방지 4. CellViewModel Cell에 주입하는 방식으로 변경 --- .../Src/Home/FallingHomeViewController.swift | 78 +++++++++---------- .../Src/Home/FallingHomeViewModel.swift | 45 +++++++---- .../Cell/FallingUserCollectionViewCell.swift | 67 +++++++--------- .../FallinguserCollectionViewCellModel.swift | 15 +++- .../Cell/ProfileCollectionViewCell.swift | 2 +- 5 files changed, 108 insertions(+), 99 deletions(-) diff --git a/Projects/Features/Falling/Src/Home/FallingHomeViewController.swift b/Projects/Features/Falling/Src/Home/FallingHomeViewController.swift index b118ab35..a86b089f 100644 --- a/Projects/Features/Falling/Src/Home/FallingHomeViewController.swift +++ b/Projects/Features/Falling/Src/Home/FallingHomeViewController.swift @@ -13,7 +13,7 @@ import FallingInterface final class FallingHomeViewController: TFBaseViewController { private let viewModel: FallingHomeViewModel - private var dataSource: UICollectionViewDiffableDataSource! + private var dataSource: DataSource! private lazy var homeView = FallingHomeView() init(viewModel: FallingHomeViewModel) { @@ -36,16 +36,18 @@ final class FallingHomeViewController: TFBaseViewController { let mindImageView = UIImageView(image: DSKitAsset.Image.Icons.mind.image) let mindImageItem = UIBarButtonItem(customView: mindImageView) - let notificationButtonItem = UIBarButtonItem(image: DSKitAsset.Image.Icons.bell.image, style: .plain, target: nil, action: nil) - + let notificationButtonItem = UIBarButtonItem.noti + navigationItem.leftBarButtonItem = mindImageItem navigationItem.rightBarButtonItem = notificationButtonItem } override func bindViewModel() { + let timeOverSubject = PublishSubject() + let initialTrigger = Driver.just(()) - let timerOverTrigger = self.rx.timeOverTrigger.asDriver() - + let timerOverTrigger = timeOverSubject.asDriverOnErrorJustEmpty() + let viewWillAppearTrigger = self.rx.viewWillAppear.map { _ in true }.asDriverOnErrorJustEmpty() let viewWillDisAppearTrigger = self.rx.viewWillDisAppear.map { _ in false }.asDriverOnErrorJustEmpty() let timerActiveRelay = BehaviorRelay(value: true) @@ -56,7 +58,7 @@ final class FallingHomeViewController: TFBaseViewController { .when(.recognized) .withLatestFrom(timerActiveRelay) { !$1 } .asDriverOnErrorJustEmpty() - + cardDoubleTapTrigger .drive(timerActiveRelay) .disposed(by: disposeBag) @@ -65,61 +67,57 @@ final class FallingHomeViewController: TFBaseViewController { .drive(timerActiveRelay) .disposed(by: disposeBag) - let input = FallingHomeViewModel.Input(initialTrigger: initialTrigger, - timeOverTrigger: timerOverTrigger) + let input = FallingHomeViewModel.Input( + initialTrigger: initialTrigger, + timeOverTrigger: timerOverTrigger) let output = viewModel.transform(input: input) - var usersCount = 0 - - let profileCellRegistration = UICollectionView.CellRegistration { [weak self] cell, indexPath, item in - let observer = FallingUserCollectionViewCellObserver( - userCardScrollIndex: output.userCardScrollIndex.asObservable(), - timerActiveTrigger: timerActiveRelay.asObservable() + let profileCellRegistration = UICollectionView.CellRegistration { cell, indexPath, item in + let timerActiveTrigger = Driver.combineLatest( + output.userCardScrollIndex, + timerActiveRelay.asDriver() + ) + .filter { indexPath.row == $0.0 } + .map { $0.1 } + .debug("cell timer active") + + cell.bind( + FallinguserCollectionViewCellModel(userDomain: item), + timerActiveTrigger, + scrollToNextObserver: timeOverSubject ) - - cell.bind(model: item) - cell.bind(observer, - index: indexPath, - usersCount: usersCount) - cell.delegate = self } - - dataSource = UICollectionViewDiffableDataSource(collectionView: homeView.collectionView, cellProvider: { collectionView, indexPath, itemIdentifier in + dataSource = DataSource(collectionView: homeView.collectionView, cellProvider: { collectionView, indexPath, itemIdentifier in return collectionView.dequeueConfiguredReusableCell(using: profileCellRegistration, for: indexPath, item: itemIdentifier) }) output.userList .drive(with: self, onNext: { this, list in - usersCount = list.count - var snapshot = NSDiffableDataSourceSnapshot() + var snapshot = Snapshot() snapshot.appendSections([.profile]) snapshot.appendItems(list) this.dataSource.apply(snapshot) }).disposed(by: disposeBag) - output.userCardScrollIndex + output.nextCardIndex .drive(with: self, onNext: { this, index in - if usersCount == 0 { return } - let index = index >= usersCount ? usersCount - 1 : index - let indexPath = IndexPath(row: index, section: 0) - this.homeView.collectionView.scrollToItem(at: indexPath, - at: .top, - animated: true) - }) + this.homeView.collectionView.scrollToItem( + at: index, + at: .top, + animated: true)}) .disposed(by: self.disposeBag) } } -extension FallingHomeViewController: TimeOverDelegate { - @objc func scrollToNext() { } -} +// MARK: DiffableDataSource -extension Reactive where Base: FallingHomeViewController { - var timeOverTrigger: ControlEvent { - let source = methodInvoked(#selector(Base.scrollToNext)).map { _ in } - return ControlEvent(events: source) - } +extension FallingHomeViewController { + typealias CellType = FallingUserCollectionViewCell + typealias ModelType = FallingUser + typealias SectionType = FallingProfileSection + typealias DataSource = UICollectionViewDiffableDataSource + typealias Snapshot = NSDiffableDataSourceSnapshot } //#if DEBUG diff --git a/Projects/Features/Falling/Src/Home/FallingHomeViewModel.swift b/Projects/Features/Falling/Src/Home/FallingHomeViewModel.swift index 7d0bd90e..aa191fb6 100644 --- a/Projects/Features/Falling/Src/Home/FallingHomeViewModel.swift +++ b/Projects/Features/Falling/Src/Home/FallingHomeViewModel.swift @@ -10,53 +10,66 @@ import FallingInterface import RxSwift import RxCocoa +import Foundation final class FallingHomeViewModel: ViewModelType { - + private let fallingUseCase: FallingUseCaseInterface - -// weak var delegate: FallingHomeDelegate? - + + // weak var delegate: FallingHomeDelegate? + var disposeBag: DisposeBag = DisposeBag() - + struct Input { let initialTrigger: Driver let timeOverTrigger: Driver } - + struct Output { let userList: Driver<[FallingUser]> let userCardScrollIndex: Driver + let nextCardIndex: Driver } - + init(fallingUseCase: FallingUseCaseInterface) { self.fallingUseCase = fallingUseCase } - + func transform(input: Input) -> Output { let currentIndexRelay = BehaviorRelay(value: 0) let timeOverTrigger = input.timeOverTrigger - + let usersResponse = input.initialTrigger .flatMapLatest { [unowned self] _ in self.fallingUseCase.user(alreadySeenUserUUIDList: [], userDailyFallingCourserIdx: 1, size: 100) .asDriver(onErrorJustReturn: .init(selectDailyFallingIdx: 0, topicExpirationUnixTime: 0, userInfos: [])) } - + let userList = usersResponse.map { $0.userInfos }.asDriver() - + + let userCount = userList.map { $0.count } + let userListObservable = userList.map { _ in currentIndexRelay.accept(currentIndexRelay.value) } - + let nextScrollIndex = timeOverTrigger.withLatestFrom(currentIndexRelay.asDriver(onErrorJustReturn: 0)) { _, index in currentIndexRelay.accept(index + 1) } - - let userCardScrollIndex = Driver.merge(userListObservable, nextScrollIndex).withLatestFrom(currentIndexRelay.asDriver(onErrorJustReturn: 0)) - + + let userCardScrollIndex = Driver.merge(userListObservable, nextScrollIndex).withLatestFrom(userCount) { _, count in + let currentIndex = currentIndexRelay.value + return currentIndex >= count ? count - 1 : currentIndex + } + + let nextCardIndex = userCardScrollIndex + .filter { $0 != 0 } + .map { IndexPath(row: $0, section: 0) } + return Output( userList: userList, - userCardScrollIndex: userCardScrollIndex) + userCardScrollIndex: userCardScrollIndex, + nextCardIndex: nextCardIndex + ) } } diff --git a/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift b/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift index 34655a3a..542bb59a 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift @@ -16,15 +16,8 @@ struct FallingUserCollectionViewCellObserver { var timerActiveTrigger: Observable } -@objc protocol TimeOverDelegate: AnyObject { - @objc func scrollToNext() -} - final class FallingUserCollectionViewCell: TFBaseCollectionViewCell { - var viewModel: FallinguserCollectionViewCellModel! - weak var delegate: TimeOverDelegate? = nil - lazy var profileCarouselView = ProfileCarouselView() lazy var cardTimeView = CardTimeView() @@ -48,44 +41,42 @@ final class FallingUserCollectionViewCell: TFBaseCollectionViewCell { override func prepareForReuse() { super.prepareForReuse() disposeBag = DisposeBag() - // profileCarouselView.tagCollectionView.isHidden = true } - - func bind(model: FallingUser) { - viewModel = FallinguserCollectionViewCellModel(userDomain: model) - profileCarouselView.bind(viewModel.userDomain) - } - - func bind(_ observer: FallingUserCollectionViewCellObserver, - index: IndexPath, - usersCount: Int) { - - let timerActiveTrigger = - observer.userCardScrollIndex - .observe(on: MainScheduler.asyncInstance) - .withLatestFrom(observer.timerActiveTrigger) { userCardScrollIndex, timerActiveTrigger in - if index.row == userCardScrollIndex { - self.profileCarouselView.hiddenDimView() - return observer.timerActiveTrigger - } - else { return Observable.just(false) } - }.map { $0 } - .flatMapLatest { return $0 } - - let input = FallinguserCollectionViewCellModel.Input(timerActiveTrigger: timerActiveTrigger.asDriver(onErrorJustReturn: false)) - + + func bind( + _ viewModel: FallinguserCollectionViewCellModel, + _ timerTrigger: Driver, + scrollToNextObserver: O) where O: ObserverType, O.Element == Void + { + let input = FallinguserCollectionViewCellModel.Input(timerActiveTrigger: timerTrigger) + let output = viewModel .transform(input: input) - + output.timeState .drive(self.rx.timeState) .disposed(by: self.disposeBag) - + + output.isDimViewHidden + .drive(with: self, onNext: { owner, isHidden in + if isHidden { + owner.profileCarouselView.hiddenDimView() + } else { + owner.profileCarouselView.showDimView() + } + }) + .disposed(by: disposeBag) + output.timeZero - .do { [weak self] _ in self?.delegate?.scrollToNext() } - .drive() - .disposed(by: self.disposeBag) - + .drive(scrollToNextObserver) + .disposed(by: disposeBag) + + output.user + .drive(with: self, onNext: { owner, user in + owner.profileCarouselView.bind(user) + }) + .disposed(by: disposeBag) + profileCarouselView.infoButton.rx.tap.asDriver() .scan(true) { lastValue, _ in return !lastValue diff --git a/Projects/Features/Falling/Src/Subviews/Cell/FallinguserCollectionViewCellModel.swift b/Projects/Features/Falling/Src/Subviews/Cell/FallinguserCollectionViewCellModel.swift index a97d0a3a..3510f591 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/FallinguserCollectionViewCellModel.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/FallinguserCollectionViewCellModel.swift @@ -129,8 +129,9 @@ final class FallinguserCollectionViewCellModel: ViewModelType { struct Output { let timeState: Driver - let timeZero: Driver + let timeZero: Driver let user: Driver + let isDimViewHidden: Driver } func transform(input: Input) -> Output { @@ -161,12 +162,18 @@ final class FallinguserCollectionViewCellModel: ViewModelType { }.asDriver(onErrorJustReturn: 8.0) let timeState = timer.map { TimeState(rawValue: $0) } - let timeZero = timer.filter { $0 == 0 } - + let timeZero = timer.filter { $0 == 0 }.map { _ in } + + let isDimViewHidden = Driver.merge( + timerActiveTrigger.take(1).asDriverOnErrorJustEmpty(), // take(1)을 해주지 않으면 일시정지 때마다 dimmed 됨 + timeZero.map { _ in false } + ) + return Output( timeState: timeState, timeZero: timeZero, - user: user + user: user, + isDimViewHidden: isDimViewHidden ) } } diff --git a/Projects/Features/Falling/Src/Subviews/Cell/ProfileCollectionViewCell.swift b/Projects/Features/Falling/Src/Subviews/Cell/ProfileCollectionViewCell.swift index 3fea4a04..1e57bc98 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/ProfileCollectionViewCell.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/ProfileCollectionViewCell.swift @@ -13,7 +13,7 @@ import DSKit final class ProfileCollectionViewCell: UICollectionViewCell { private lazy var imageView: UIImageView = { let imageView = UIImageView() - imageView.contentMode = .scaleToFill + imageView.contentMode = .scaleAspectFill imageView.layer.masksToBounds = true return imageView }() From 566d14ae1588c732044fe6a08ec33f4ce36f8f3f Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sun, 28 Jan 2024 20:05:31 +0900 Subject: [PATCH 09/14] =?UTF-8?q?Update:=20dim=20=EC=83=89=EC=83=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Falling/Src/Subviews/CardTimeView.swift | 2 +- .../Subviews/Cell/ProfileIntroduceCell.swift | 4 ++-- .../Src/Subviews/ProfileCarouselView.swift | 9 +-------- .../SubView/SuccessCertificationView.swift | 2 +- .../Color.xcassets/DimColor/Contents.json | 9 +++++++++ .../Default.colorset}/Contents.json | 6 +++--- .../SignUpDim.colorset}/Contents.json | 8 ++++---- .../DimColor/TimerDim.colorset/Contents.json | 20 +++++++++++++++++++ .../Src/BaseView/TFBaseView.swift | 13 +++++++----- .../Cell/ProfileIntroduceCell.swift | 2 +- 10 files changed, 50 insertions(+), 25 deletions(-) create mode 100644 Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/Contents.json rename Projects/Modules/DesignSystem/Resources/Color.xcassets/{DimColor2.colorset => DimColor/Default.colorset}/Contents.json (75%) rename Projects/Modules/DesignSystem/Resources/Color.xcassets/{DimColor.colorset => DimColor/SignUpDim.colorset}/Contents.json (66%) create mode 100644 Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/TimerDim.colorset/Contents.json diff --git a/Projects/Features/Falling/Src/Subviews/CardTimeView.swift b/Projects/Features/Falling/Src/Subviews/CardTimeView.swift index dc90b88b..7a7b505c 100644 --- a/Projects/Features/Falling/Src/Subviews/CardTimeView.swift +++ b/Projects/Features/Falling/Src/Subviews/CardTimeView.swift @@ -14,7 +14,7 @@ final class CardTimeView: TFBaseView { lazy var containerView: UIView = { let view = UIView() view.layer.cornerRadius = 15 - view.backgroundColor = DSKitAsset.Color.dimColor.color.withAlphaComponent(0.5) + view.backgroundColor = DSKitAsset.Color.DimColor.timerDim.color.withAlphaComponent(0.5) return view }() diff --git a/Projects/Features/Falling/Src/Subviews/Cell/ProfileIntroduceCell.swift b/Projects/Features/Falling/Src/Subviews/Cell/ProfileIntroduceCell.swift index fca6368e..a5b37c67 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/ProfileIntroduceCell.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/ProfileIntroduceCell.swift @@ -13,8 +13,8 @@ import DSKit final class ProfileIntroduceCell: TFBaseCollectionViewCell { private lazy var textView: UITextView = { let textView = UITextView() - textView.textColor = DSKitAsset.Color.dimColor2.color - textView.font = UIFont.thtP2M +// textView.textColor = DSKitAsset.Color.DimColor.default.color + textView.font = UIFont.thtP2R textView.isScrollEnabled = false textView.isEditable = false textView.textContainerInset = .init(top: 5, left: 5, bottom: 5, right: 5) diff --git a/Projects/Features/Falling/Src/Subviews/ProfileCarouselView.swift b/Projects/Features/Falling/Src/Subviews/ProfileCarouselView.swift index f98ecbf7..80b2f0ad 100644 --- a/Projects/Features/Falling/Src/Subviews/ProfileCarouselView.swift +++ b/Projects/Features/Falling/Src/Subviews/ProfileCarouselView.swift @@ -26,7 +26,7 @@ final class ProfileCarouselView: TFBaseView { let tagCollection = TagCollectionView() tagCollection.layer.cornerRadius = 20 tagCollection.clipsToBounds = true - tagCollection.collectionView.backgroundColor = DSKitAsset.Color.dimColor2.color + tagCollection.collectionView.backgroundColor = DSKitAsset.Color.DimColor.default.color tagCollection.isHidden = true return tagCollection }() @@ -142,13 +142,6 @@ final class ProfileCarouselView: TFBaseView { $0.bottom.equalToSuperview().offset(-30) } - self.dimView.layer.cornerRadius = 12 - - self.showDimView(frame: CGRect(x: 0, - y: 0, - width: (UIWindow.keyWindow?.frame.width ?? 0) - 32, - height: UIWindow.keyWindow?.frame.height ?? 0)) - configureDataSource() } diff --git a/Projects/Features/SignUp/Src/SubView/SuccessCertificationView.swift b/Projects/Features/SignUp/Src/SubView/SuccessCertificationView.swift index f980cb05..7ed087bd 100644 --- a/Projects/Features/SignUp/Src/SubView/SuccessCertificationView.swift +++ b/Projects/Features/SignUp/Src/SubView/SuccessCertificationView.swift @@ -31,7 +31,7 @@ final class SuccessCertificationView: UIView { } func makeUI() { - self.backgroundColor = DSKitAsset.Color.dimColor.color + self.backgroundColor = DSKitAsset.Color.DimColor.signUpDim.color self.addSubview(backCardView) diff --git a/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/Contents.json b/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/Contents.json new file mode 100644 index 00000000..6e965652 --- /dev/null +++ b/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/Contents.json @@ -0,0 +1,9 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "provides-namespace" : true + } +} diff --git a/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor2.colorset/Contents.json b/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/Default.colorset/Contents.json similarity index 75% rename from Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor2.colorset/Contents.json rename to Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/Default.colorset/Contents.json index 74b61cb4..69c422e6 100644 --- a/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor2.colorset/Contents.json +++ b/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/Default.colorset/Contents.json @@ -5,9 +5,9 @@ "color-space" : "srgb", "components" : { "alpha" : "0.500", - "blue" : "0x11", - "green" : "0x11", - "red" : "0x11" + "blue" : "0x00", + "green" : "0x00", + "red" : "0x00" } }, "idiom" : "universal" diff --git a/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor.colorset/Contents.json b/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/SignUpDim.colorset/Contents.json similarity index 66% rename from Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor.colorset/Contents.json rename to Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/SignUpDim.colorset/Contents.json index 2879a8d0..d1dbdaa9 100644 --- a/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor.colorset/Contents.json +++ b/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/SignUpDim.colorset/Contents.json @@ -4,10 +4,10 @@ "color" : { "color-space" : "srgb", "components" : { - "alpha" : "0.800", - "blue" : "0x11", - "green" : "0x11", - "red" : "0x11" + "alpha" : "0.250", + "blue" : "0x00", + "green" : "0x00", + "red" : "0x00" } }, "idiom" : "universal" diff --git a/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/TimerDim.colorset/Contents.json b/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/TimerDim.colorset/Contents.json new file mode 100644 index 00000000..0361de7b --- /dev/null +++ b/Projects/Modules/DesignSystem/Resources/Color.xcassets/DimColor/TimerDim.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "0.500", + "blue" : "0x1A", + "green" : "0x1A", + "red" : "0x1A" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/Modules/DesignSystem/Src/BaseView/TFBaseView.swift b/Projects/Modules/DesignSystem/Src/BaseView/TFBaseView.swift index 1ad711c7..d61502b4 100644 --- a/Projects/Modules/DesignSystem/Src/BaseView/TFBaseView.swift +++ b/Projects/Modules/DesignSystem/Src/BaseView/TFBaseView.swift @@ -10,7 +10,7 @@ import UIKit open class TFBaseView: UIView { public lazy var dimView: UIView = { let view = UIView() - view.backgroundColor = .clear + view.backgroundColor = DSKitAsset.Color.DimColor.default.color return view }() override public init(frame: CGRect) { @@ -27,10 +27,11 @@ open class TFBaseView: UIView { public func showDimView(frame: CGRect = UIWindow.keyWindow?.frame ?? .zero) { dimView.frame = frame - DispatchQueue.main.async { + DispatchQueue.main.async { [weak self] in + guard let self = self else { return } self.addSubview(self.dimView) UIView.animate(withDuration: 0.0) { - self.dimView.backgroundColor = DSKitAsset.Color.cardShadow.color.withAlphaComponent(0.7) + self.dimView.backgroundColor = DSKitAsset.Color.cardShadow.color.withAlphaComponent(0.7) } } } @@ -38,9 +39,11 @@ open class TFBaseView: UIView { public func hiddenDimView() { DispatchQueue.main.async { UIView.animate(withDuration: 0.0) { [weak self] in - self?.dimView.backgroundColor = .clear + guard let self = self else { return } + self.dimView.backgroundColor = DSKitAsset.Color.DimColor.default.color } completion: { [weak self] _ in - self?.dimView.removeFromSuperview() + guard let self = self else { return } + self.dimView.removeFromSuperview() } } } diff --git a/Projects/Modules/DesignSystem/Src/UIComponent/Cell/ProfileIntroduceCell.swift b/Projects/Modules/DesignSystem/Src/UIComponent/Cell/ProfileIntroduceCell.swift index ce0dfd04..14981661 100644 --- a/Projects/Modules/DesignSystem/Src/UIComponent/Cell/ProfileIntroduceCell.swift +++ b/Projects/Modules/DesignSystem/Src/UIComponent/Cell/ProfileIntroduceCell.swift @@ -11,7 +11,7 @@ public final class ProfileIntroduceCell: TFBaseCollectionViewCell { private lazy var textView: UITextView = { let textView = UITextView() - textView.textColor = DSKitAsset.Color.dimColor2.color + textView.textColor = DSKitAsset.Color.neutral50.color textView.font = UIFont.thtP2M textView.isScrollEnabled = false textView.isEditable = false From a25104186818e8d910a57a65ed916da3bf9f045d Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Sun, 28 Jan 2024 20:13:16 +0900 Subject: [PATCH 10/14] =?UTF-8?q?[#=20]