Skip to content

Commit 872f289

Browse files
authored
Merge pull request #100 from PopPool/fix/#82-block-swipe-when-carousel-have-one-image
[FIX] ์‚ฌ์ง„์ด ํ•œ์žฅ์ผ ๋•Œ ๋ฌดํ•œ ์Šคํฌ๋กค์„ ๋ฐฉ์ง€ํ•˜๋„๋ก ์ˆ˜์ •
2 parents 9ebc3b6 + 4b8a89b commit 872f289

File tree

5 files changed

+22
-42
lines changed

5 files changed

+22
-42
lines changed

โ€ŽPoppool/Poppool.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolvedโ€Ž

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

โ€ŽPoppool/Poppool/Presentation/Scene/Detail/DetailController.swiftโ€Ž

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// DetailController.swift
3-
// Poppool
4-
//
5-
// Created by SeoJunYoung on 12/9/24.
6-
//
7-
81
import UIKit
92

103
import ReactorKit

โ€ŽPoppool/Poppool/Presentation/Scene/Home/Main/HomeController.swiftโ€Ž

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// HomeController.swift
3-
// Poppool
4-
//
5-
// Created by SeoJunYoung on 11/28/24.
6-
//
7-
81
import UIKit
92

103
import ReactorKit

โ€ŽPoppool/Poppool/Presentation/Scene/Home/Main/HomeReactor.swiftโ€Ž

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// HomeReactor.swift
3-
// Poppool
4-
//
5-
// Created by SeoJunYoung on 11/28/24.
6-
//
7-
81
import UIKit
92

103
import ReactorKit

โ€ŽPoppool/Poppool/Presentation/Scene/Home/Main/View/ImageBannerSection/ImageBannerSection/ImageBannerSectionCell.swiftโ€Ž

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// ImageBannerSectionCell.swift
3-
// Poppool
4-
//
5-
// Created by SeoJunYoung on 11/28/24.
6-
//
7-
81
import UIKit
92

103
import RxSwift
@@ -91,6 +84,8 @@ final class ImageBannerSectionCell: UICollectionViewCell {
9184
autoScrollTimer = nil
9285
}
9386

87+
// FIXME: (ํ™ˆ -> ์ƒ์„ธ) ์ด๋™ ์‹œ ํ™ˆ์˜ ์ž๋™ ์Šคํฌ๋กค์ด ๊ณ„์† ๋Œ์•„๊ฐ.
88+
// FIXME: ๋˜ํ•œ ์˜คํ†  ์Šคํฌ๋กค์„ ํ•œ๋ฒˆ๋งŒ ์‹คํ–‰ํ•˜๋ฉด ๋˜๋Š”๋ฐ, ์‚ฌ์ง„์ด ๋„˜์–ด๊ฐˆ ๋•Œ ๋งˆ๋‹ค ์‹คํ–‰๋˜๋Š”๊ฒƒ์œผ๋กœ ๋ณด์ž„
9489
func startAutoScroll(interval: TimeInterval = 3.0) {
9590
stopAutoScroll() // ๊ธฐ์กด ํƒ€์ด๋จธ๋ฅผ ์ค‘์ง€
9691
stopButton.isHidden = false
@@ -206,16 +201,20 @@ extension ImageBannerSectionCell: Inputable {
206201
if imageSection.isEmpty {
207202
pageControl.setNumberOfPages(input.imagePaths.count)
208203
let datas = zip(input.imagePaths, input.idList)
209-
let backContents = datas.suffix(1)
210-
let frontContents = datas.prefix(1)
211-
imageSection.inputDataList = datas.map { .init(imagePath: $0.0, id: $0.1) }
212-
imageSection.inputDataList.append(contentsOf: frontContents.map { .init(imagePath: $0.0, id: $0.1) })
213-
imageSection.inputDataList = backContents.map {.init(imagePath: $0.0, id: $0.1) } + imageSection.inputDataList
214-
DispatchQueue.main.async { [weak self] in
215-
self?.contentCollectionView.scrollToItem(
216-
at: .init(row: 1, section: 0),
217-
at: .centeredHorizontally, animated: false
218-
)
204+
if input.imagePaths.count > 1 {
205+
let backContents = datas.suffix(1)
206+
let frontContents = datas.prefix(1)
207+
imageSection.inputDataList = datas.map { .init(imagePath: $0.0, id: $0.1) }
208+
imageSection.inputDataList.append(contentsOf: frontContents.map { .init(imagePath: $0.0, id: $0.1) })
209+
imageSection.inputDataList = backContents.map { .init(imagePath: $0.0, id: $0.1) } + imageSection.inputDataList
210+
DispatchQueue.main.async { [weak self] in
211+
self?.contentCollectionView.scrollToItem(
212+
at: .init(row: 1, section: 0),
213+
at: .centeredHorizontally, animated: false
214+
)
215+
}
216+
} else {
217+
imageSection.inputDataList = datas.map { .init(imagePath: $0.0, id: $0.1) }
219218
}
220219
}
221220

@@ -264,6 +263,8 @@ extension ImageBannerSectionCell: UICollectionViewDelegate, UICollectionViewData
264263
}
265264

266265
func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
266+
guard imageSection.dataCount > 1 else { return }
267+
267268
if currentIndex == 0 {
268269
contentCollectionView.scrollToItem(
269270
at: .init(row: imageSection.dataCount - 2, section: 0),

0 commit comments

Comments
ย (0)