diff --git a/Projects/Feature/Sources/Scene/Map/View/MapBottomSheetView.swift b/Projects/Feature/Sources/Scene/Map/View/MapBottomSheetView.swift index 9ff67ab..8b1d6da 100644 --- a/Projects/Feature/Sources/Scene/Map/View/MapBottomSheetView.swift +++ b/Projects/Feature/Sources/Scene/Map/View/MapBottomSheetView.swift @@ -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 @@ -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 { @@ -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() + } @objc private func didTapCard(_ sender: UITapGestureRecognizer) { diff --git a/Projects/Feature/Sources/Scene/Map/View/MapViewController.swift b/Projects/Feature/Sources/Scene/Map/View/MapViewController.swift index 57e9ae7..5798698 100644 --- a/Projects/Feature/Sources/Scene/Map/View/MapViewController.swift +++ b/Projects/Feature/Sources/Scene/Map/View/MapViewController.swift @@ -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 +} private let placeDetailView = MapPlaceDetailView().then { $0.isHidden = true $0.clipsToBounds = true @@ -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 private let detailMinHeight: CGFloat = 225 private var selectedPlaceId: Int = -1 private var currentPlaceDetail: MapPlaceDetailModel? @@ -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) } } private func setupLayout() { @@ -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) + } placeDetailView.snp.makeConstraints { $0.leading.trailing.bottom.equalToSuperview() self.detailSheetHeight = $0.height.equalTo(0).priority(.high).constraint @@ -733,6 +741,7 @@ private func styleIDForCategory(_ category: String) -> String { } private func setupGesture() { + bottomSheetHandleTouchArea.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handlePan))) bottomSheetView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handlePan))) placeDetailView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handlePan))) }