Skip to content

Commit

Permalink
[FEAT] 장소 필터링 모달 뷰 구현 (슬라이더 제외) (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurim830 authored Jan 16, 2025
2 parents 0ae6807 + efaccb3 commit d10daef
Show file tree
Hide file tree
Showing 11 changed files with 463 additions and 191 deletions.
16 changes: 12 additions & 4 deletions ACON-iOS/ACON-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
1547A88B2D3596B600E96616 /* SpotType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1547A88A2D3596B600E96616 /* SpotType.swift */; };
1547A88E2D35B13700E96616 /* FilterTagButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1547A88D2D35B13700E96616 /* FilterTagButton.swift */; };
1547A8902D35B30C00E96616 /* FilterTagButtonType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1547A88F2D35B30C00E96616 /* FilterTagButtonType.swift */; };
1547A8922D363E0000E96616 /* SpotFilterTagButtonStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1547A8912D363E0000E96616 /* SpotFilterTagButtonStackView.swift */; };
1558BA1A2D318FFC00ECDEF8 /* ACTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1558BA192D318FFC00ECDEF8 /* ACTabBarController.swift */; };
1558BADB2D31AAF900ECDEF8 /* ACTabBarItemType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1558BADA2D31AAF900ECDEF8 /* ACTabBarItemType.swift */; };
1558BADE2D31AB6C00ECDEF8 /* SpotListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1558BADD2D31AB6C00ECDEF8 /* SpotListViewController.swift */; };
1558BAE12D31D41F00ECDEF8 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1558BAE02D31D41F00ECDEF8 /* ProfileViewController.swift */; };
15A3F6A62D36C49F00577E16 /* SpotListItemSizeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3F6A52D36C49F00577E16 /* SpotListItemSizeType.swift */; };
15A3F6A82D36D5B900577E16 /* FilterTagButtonStackLineType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3F6A72D36D5B900577E16 /* FilterTagButtonStackLineType.swift */; };
15A3F6E02D38724A00577E16 /* CustomSegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3F6DF2D38724A00577E16 /* CustomSegmentedControl.swift */; };
15A3F7A12D38C71900577E16 /* PriorityLowEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3F7A02D38C71900577E16 /* PriorityLowEmptyView.swift */; };
15A3F7A32D38C7FF00577E16 /* SpotFilterTagStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3F7A22D38C7FF00577E16 /* SpotFilterTagStackView.swift */; };
71DE8AE7F1C4CF9051C631A3 /* Pods_ACON_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B28431BAB67B99CD7B85C705 /* Pods_ACON_iOS.framework */; };
74054ECA2D32534200D1CDE4 /* MultitaskDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74054EC92D32533800D1CDE4 /* MultitaskDelegate.swift */; };
74054ECE2D32549F00D1CDE4 /* ACLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74054ECD2D32549800D1CDE4 /* ACLocationManager.swift */; };
Expand Down Expand Up @@ -105,13 +107,15 @@
1547A88A2D3596B600E96616 /* SpotType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpotType.swift; sourceTree = "<group>"; };
1547A88D2D35B13700E96616 /* FilterTagButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterTagButton.swift; sourceTree = "<group>"; };
1547A88F2D35B30C00E96616 /* FilterTagButtonType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterTagButtonType.swift; sourceTree = "<group>"; };
1547A8912D363E0000E96616 /* SpotFilterTagButtonStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpotFilterTagButtonStackView.swift; sourceTree = "<group>"; };
1558BA192D318FFC00ECDEF8 /* ACTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ACTabBarController.swift; sourceTree = "<group>"; };
1558BADA2D31AAF900ECDEF8 /* ACTabBarItemType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ACTabBarItemType.swift; sourceTree = "<group>"; };
1558BADD2D31AB6C00ECDEF8 /* SpotListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpotListViewController.swift; sourceTree = "<group>"; };
1558BAE02D31D41F00ECDEF8 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
15A3F6A52D36C49F00577E16 /* SpotListItemSizeType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpotListItemSizeType.swift; sourceTree = "<group>"; };
15A3F6A72D36D5B900577E16 /* FilterTagButtonStackLineType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterTagButtonStackLineType.swift; sourceTree = "<group>"; };
15A3F6DF2D38724A00577E16 /* CustomSegmentedControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSegmentedControl.swift; sourceTree = "<group>"; };
15A3F7A02D38C71900577E16 /* PriorityLowEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PriorityLowEmptyView.swift; sourceTree = "<group>"; };
15A3F7A22D38C7FF00577E16 /* SpotFilterTagStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpotFilterTagStackView.swift; sourceTree = "<group>"; };
50546F80D11F73C6A00B6C92 /* Pods-ACON-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ACON-iOS.release.xcconfig"; path = "Target Support Files/Pods-ACON-iOS/Pods-ACON-iOS.release.xcconfig"; sourceTree = "<group>"; };
74054EC92D32533800D1CDE4 /* MultitaskDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultitaskDelegate.swift; sourceTree = "<group>"; };
74054ECD2D32549800D1CDE4 /* ACLocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ACLocationManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -296,8 +300,10 @@
1547A88C2D35AE5C00E96616 /* Component */ = {
isa = PBXGroup;
children = (
15A3F6DF2D38724A00577E16 /* CustomSegmentedControl.swift */,
1547A88D2D35B13700E96616 /* FilterTagButton.swift */,
1547A8912D363E0000E96616 /* SpotFilterTagButtonStackView.swift */,
15A3F7A02D38C71900577E16 /* PriorityLowEmptyView.swift */,
15A3F7A22D38C7FF00577E16 /* SpotFilterTagStackView.swift */,
);
path = Component;
sourceTree = "<group>";
Expand Down Expand Up @@ -777,6 +783,7 @@
748D6F822D2BCDB3007690B4 /* ScreenUtils.swift in Sources */,
745C7E122D35A62B0074DBDB /* UploadModel.swift in Sources */,
748D6FAE2D2EBB9C007690B4 /* ACFont.swift in Sources */,
15A3F6E02D38724A00577E16 /* CustomSegmentedControl.swift in Sources */,
748D6F692D2BCA1C007690B4 /* AppDelegate.swift in Sources */,
74054ECE2D32549F00D1CDE4 /* ACLocationManager.swift in Sources */,
745C7E0D2D35A04A0074DBDB /* RelatedSearchCollectionViewCell.swift in Sources */,
Expand All @@ -789,6 +796,7 @@
1547A8902D35B30C00E96616 /* FilterTagButtonType.swift in Sources */,
748ECA712D31A72A00BBC981 /* LoginViewModel.swift in Sources */,
748D6F872D2BD247007690B4 /* UIView+.swift in Sources */,
15A3F7A32D38C7FF00577E16 /* SpotFilterTagStackView.swift in Sources */,
1547A6EB2D337F4100E96616 /* SpotListView.swift in Sources */,
1547A6EF2D33854B00E96616 /* SpotListCollectionViewCell.swift in Sources */,
74CDCE562D310B1600E3A21A /* String+.swift in Sources */,
Expand All @@ -804,7 +812,6 @@
741A07592D355F1400778219 /* ReviewFinishedViewController.swift in Sources */,
748D6F892D2BD294007690B4 /* UIViewController+.swift in Sources */,
745C7E042D3599DF0074DBDB /* SpotSearchViewController.swift in Sources */,
1547A8922D363E0000E96616 /* SpotFilterTagButtonStackView.swift in Sources */,
74B25C2C2D2FEE8E008BDCB7 /* Config.swift in Sources */,
74054ECA2D32534200D1CDE4 /* MultitaskDelegate.swift in Sources */,
748D6F8F2D2BD340007690B4 /* UIButton+.swift in Sources */,
Expand All @@ -817,6 +824,7 @@
1558BA1A2D318FFC00ECDEF8 /* ACTabBarController.swift in Sources */,
1547A8802D358E2700E96616 /* SpotListFilterView.swift in Sources */,
74CDCE542D310A1C00E3A21A /* ACFontStyleType.swift in Sources */,
15A3F7A12D38C71900577E16 /* PriorityLowEmptyView.swift in Sources */,
748D6F802D2BCD94007690B4 /* ObservablePattern.swift in Sources */,
1558BADE2D31AB6C00ECDEF8 /* SpotListViewController.swift in Sources */,
74BF92102D391FFE00B923E3 /* LocalVerificationFinishedView.swift in Sources */,
Expand Down
14 changes: 14 additions & 0 deletions ACON-iOS/ACON-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,18 @@ enum StringLiterals {
static let plainAcorn = "일반 도토리"
}

enum SpotListFilter {

static let restaurant = "음식점"

static let cafe = "카페"

static let spotSection = "방문 장소"

static let companionSection = "함께 하는 사람"

static let visitPurposeSection = "방문 목적"

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,6 @@ import Foundation

struct SpotListFilterModel {

// TODO: Type에 포함시키는 방향으로 수정
struct RestaurantFeature {

static let firstLine: [SpotType.RestaurantFeatureType] = [
.korean, .western, .chinese, .japanese, .snack
]

static let secondLine: [SpotType.RestaurantFeatureType] = [
.asian, .bar, .excludeFranchise
]

}

struct CafeFeature {

static let firstLine: [SpotType.CafeFeatureType] = [
.large, .goodView, .dessert, .terace
]

static let secondLine: [SpotType.CafeFeatureType] = [
.excludeFranchise
]

}

struct Companion {

static let firstLine: [SpotType.CompanionType] = [
.family, .date, .friend, .alone, .group
]

static let secondLine: [SpotType.CompanionType] = []

}

struct VisitPurpose {

static let firstLine: [SpotType.VisitPurposeType] = [
.meeting, .study
]

static let secondLine: [SpotType.VisitPurposeType] = []

}
// TODO: 데이터 모델 구현

}
16 changes: 4 additions & 12 deletions ACON-iOS/ACON-iOS/Presentation/SpotListFilter/Type/SpotType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ enum SpotType {

// MARK: - 장소 상세 조건

enum RestaurantFeatureType {
enum RestaurantFeatureType: CaseIterable {

case korean, western, chinese, japanese, snack, asian, bar, excludeFranchise

Expand All @@ -40,13 +40,9 @@ enum SpotType {
}
}

var firstLineCount: Int {
return 5
}

}

enum CafeFeatureType {
enum CafeFeatureType: CaseIterable {

case large, goodView, dessert, terace, excludeFranchise

Expand All @@ -60,13 +56,9 @@ enum SpotType {
}
}

var firstLineCount: Int {
return 4
}

}

enum CompanionType {
enum CompanionType: CaseIterable {

case family, date, friend, alone, group

Expand All @@ -82,7 +74,7 @@ enum SpotType {

}

enum VisitPurposeType {
enum VisitPurposeType: CaseIterable {

case meeting, study

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//
// SpotSegmentedControl.swift
// ACON-iOS
//
// Created by 김유림 on 1/16/25.
//

import UIKit

import Then

// TODO: 커스텀 세그먼트컨트롤 만들기...
/// - 배경 insets
/// - attributed string

class CustomSegmentedControl: UISegmentedControl {



// override init(frame: CGRect) {
// super.init(frame: frame)
//// self.removeBackgroundAndDivider()
// }

init() {
let segmentItems = [StringLiterals.SpotListFilter.restaurant,
StringLiterals.SpotListFilter.cafe]
super.init(items: segmentItems)

setStyle()
}

required init?(coder: NSCoder) {
fatalError()
}

// TODO: 커스텀
private func removeBackgroundAndDivider() {
let image = UIImage()
self.setBackgroundImage(image, for: .normal, barMetrics: .default)
self.setBackgroundImage(image, for: .selected, barMetrics: .default)
self.setBackgroundImage(image, for: .highlighted, barMetrics: .default)

self.setDividerImage(image, forLeftSegmentState: .selected, rightSegmentState: .normal, barMetrics: .default)
}

private func setStyle() {
self.do {
$0.selectedSegmentIndex = 0
$0.selectedSegmentTintColor = .acWhite
$0.backgroundColor = .gray8
$0.setTitleTextAttributes(ACStyle(.s2, .gray5), for: .normal)
$0.setTitleTextAttributes(ACStyle(.s2, .gray9), for: .selected)
}
}

func ACStyle(_ style: ACFontStyleType, _ color: UIColor = .acWhite) -> [NSAttributedString.Key: Any] {
let attributes: [NSAttributedString.Key: Any] = [
.font: style.font,
.kern: style.kerning,
.paragraphStyle: {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.minimumLineHeight = style.lineHeight
paragraphStyle.maximumLineHeight = style.lineHeight
return paragraphStyle
}(),
.foregroundColor: color,
.baselineOffset: (style.lineHeight - style.font.lineHeight) / 2
]

return attributes
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class FilterTagButton: UIButton {

override var isSelected: Bool {
didSet {
print("button isSelected")
configuration?.baseBackgroundColor = isSelected ? .subOrg35 : .gray8
configuration?.background.strokeColor = isSelected ? .org1 : .gray6
}
Expand All @@ -26,6 +25,9 @@ class FilterTagButton: UIButton {
super.init(frame: frame)

configureButton()
setLayout()
addTarget()

}

required init?(coder: NSCoder) {
Expand All @@ -47,12 +49,34 @@ private extension FilterTagButton {
config.background.strokeWidth = 1
config.cornerStyle = .capsule
config.titleAlignment = .center
config.titleLineBreakMode = .byTruncatingTail
config.contentInsets = NSDirectionalEdgeInsets(top: 7,
leading: 16,
bottom: 7,
trailing: 16)

self.configuration = config
}

func setLayout() {
self.snp.makeConstraints {
$0.height.equalTo(32)
}
}

func addTarget() {
self.addTarget(self, action: #selector(toggleSelf), for: .touchUpInside)
}

}


// MARK: - @objc functions

private extension FilterTagButton {

@objc
func toggleSelf(_ sender: UIButton) {
isSelected.toggle()
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// PriorityLowEmptyView.swift
// ACON-iOS
//
// Created by 김유림 on 1/16/25.
//

import UIKit

class PriorityLowEmptyView: UIView {

override init(frame: CGRect) {
super.init(frame: frame)

setContentHuggingPriority(.defaultLow, for: .horizontal)
setContentHuggingPriority(.defaultLow, for: .vertical)
}

required init?(coder: NSCoder) {
super.init(coder: coder)
}

}
Loading

0 comments on commit d10daef

Please sign in to comment.