Skip to content
21 changes: 14 additions & 7 deletions Projects/Feature/Sources/Scene/Map/View/MapBottomSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public final class MapBottomSheetView: UIView {
$0.backgroundColor = UIColor.color.gomsDivider.color
$0.layer.cornerRadius = 2.5
}
private let handleTouchArea = UIView()
private let scrollView = UIScrollView().then {
$0.showsVerticalScrollIndicator = false
$0.alwaysBounceVertical = true
Expand Down Expand Up @@ -93,19 +94,26 @@ public final class MapBottomSheetView: UIView {
}

private func addView() {
addSubview(handleView)
addSubview(handleTouchArea)
handleTouchArea.addSubview(handleView)
addSubview(scrollView)
scrollView.addSubview(contentStackView)
}

private func setLayout() {
handleTouchArea.snp.makeConstraints {
$0.top.equalToSuperview()
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(40)
}

handleView.snp.makeConstraints {
$0.top.equalToSuperview().offset(8)
$0.centerX.equalToSuperview()
$0.width.equalTo(40); $0.height.equalTo(5)
$0.center.equalToSuperview()
$0.width.equalTo(40)
$0.height.equalTo(5)
}
scrollView.snp.makeConstraints {
$0.top.equalTo(handleView.snp.bottom).offset(8)
$0.top.equalTo(handleTouchArea.snp.bottom).offset(8)
$0.leading.trailing.bottom.equalToSuperview()
}
contentStackView.snp.makeConstraints {
Expand Down Expand Up @@ -212,8 +220,7 @@ public final class MapBottomSheetView: UIView {
guard index < reviewPlaces.count else { return }
let placeId = reviewPlaces[index].id
onDeleteTapped?(placeId)
reviewPlaces.remove(at: index)
renderUI()

Comment thread
juunpy0 marked this conversation as resolved.
}

@objc private func didTapCard(_ sender: UITapGestureRecognizer) {
Expand Down
13 changes: 11 additions & 2 deletions Projects/Feature/Sources/Scene/Map/View/MapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ private let recentSearchView = MapRecentSearchView().then {
$0.tableView.backgroundColor = .color.background.color
}
private let bottomSheetView = MapBottomSheetView()
private let bottomSheetHandleTouchArea = UIView().then {
$0.backgroundColor = .clear
}
Comment thread
juunpy0 marked this conversation as resolved.
private let placeDetailView = MapPlaceDetailView().then {
$0.isHidden = true
$0.clipsToBounds = true
Expand All @@ -80,7 +83,7 @@ private let placeDetailView = MapPlaceDetailView().then {
private var bottomSheetHeight: Constraint?
private var detailSheetHeight: Constraint?
private let defaultHeight: CGFloat = 240
private let firstHeight: CGFloat = 20
private let firstHeight: CGFloat = 30
Comment thread
juunpy0 marked this conversation as resolved.
private let detailMinHeight: CGFloat = 225
private var selectedPlaceId: Int = -1
private var currentPlaceDetail: MapPlaceDetailModel?
Expand Down Expand Up @@ -204,7 +207,7 @@ private func setupView() {
self.view.backgroundColor = .black
view.backgroundColor = .color.background.color
view.addSubview(mapWrapperView)
[bottomSheetView, recentSearchView, routeSelectionView, placeDetailView, searchBar].forEach { view.addSubview($0) }
[bottomSheetView, bottomSheetHandleTouchArea, recentSearchView, routeSelectionView, placeDetailView, searchBar].forEach { view.addSubview($0) }
Comment thread
juunpy0 marked this conversation as resolved.
}

private func setupLayout() {
Expand All @@ -219,6 +222,11 @@ private func setupLayout() {
$0.leading.trailing.bottom.equalToSuperview()
self.bottomSheetHeight = $0.height.equalTo(defaultHeight).constraint
}
bottomSheetHandleTouchArea.snp.makeConstraints {
$0.leading.trailing.equalToSuperview()
$0.bottom.equalTo(bottomSheetView.snp.top)
$0.height.equalTo(30)
}
Comment thread
juunpy0 marked this conversation as resolved.
placeDetailView.snp.makeConstraints {
$0.leading.trailing.bottom.equalToSuperview()
self.detailSheetHeight = $0.height.equalTo(0).priority(.high).constraint
Expand Down Expand Up @@ -733,6 +741,7 @@ private func styleIDForCategory(_ category: String) -> String {
}

private func setupGesture() {
bottomSheetHandleTouchArea.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handlePan)))
Comment thread
juunpy0 marked this conversation as resolved.
bottomSheetView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handlePan)))
placeDetailView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handlePan)))
}
Expand Down
Loading