Skip to content

Commit

Permalink
[FEAT] 장소 추천 컬렉션뷰 - 헤더, dim, footerFeature (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurim830 authored Jan 16, 2025
2 parents d10daef + 88a26ff commit a50e617
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 15 deletions.
6 changes: 5 additions & 1 deletion ACON-iOS/ACON-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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 */; };
15A3F6AC2D37AB7B00577E16 /* SpotListCollectionViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3F6AB2D37AB7B00577E16 /* SpotListCollectionViewHeader.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 @@ -116,6 +117,7 @@
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>"; };
15A3F6AB2D37AB7B00577E16 /* SpotListCollectionViewHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpotListCollectionViewHeader.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 @@ -221,6 +223,7 @@
isa = PBXGroup;
children = (
1547A6EE2D33854B00E96616 /* SpotListCollectionViewCell.swift */,
15A3F6AB2D37AB7B00577E16 /* SpotListCollectionViewHeader.swift */,
);
path = Cell;
sourceTree = "<group>";
Expand Down Expand Up @@ -441,9 +444,9 @@
children = (
74BF920F2D391FFE00B923E3 /* LocalVerification */,
74220DD12D34361E000684BF /* Upload */,
1558BADC2D31AB5100ECDEF8 /* SpotList */,
1547A87B2D358DBE00E96616 /* SpotListFilter */,
1558BADF2D31D41400ECDEF8 /* Profile */,
1558BADC2D31AB5100ECDEF8 /* SpotList */,
1558BA182D318FDB00ECDEF8 /* TabBar */,
748ECA692D31917A00BBC981 /* Login */,
748D6FA22D2C3C3D007690B4 /* Base */,
Expand Down Expand Up @@ -810,6 +813,7 @@
748D6F972D2BD544007690B4 /* DummyType.swift in Sources */,
74220DD42D34363B000684BF /* SpotUploadViewController.swift in Sources */,
741A07592D355F1400778219 /* ReviewFinishedViewController.swift in Sources */,
15A3F6AC2D37AB7B00577E16 /* SpotListCollectionViewHeader.swift in Sources */,
748D6F892D2BD294007690B4 /* UIViewController+.swift in Sources */,
745C7E042D3599DF0074DBDB /* SpotSearchViewController.swift in Sources */,
74B25C2C2D2FEE8E008BDCB7 /* Config.swift in Sources */,
Expand Down
4 changes: 4 additions & 0 deletions ACON-iOS/ACON-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ enum StringLiterals {

static let matchingRate = "취향 일치율"

static let headerTitle = "지금, 나에게 딱 맞는 맛집이에요"

static let footerText = "장소는 최대 6순위까지만 제공됩니다."

}

enum LocalVerification {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "img_dim_1.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ACON-iOS/ACON-iOS/Presentation/SpotList/Model/SpotModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extension Spots {
static let dummy: [Spot] = [
Spot(
image: .imgEx1,
matchingRate: 98,
matchingRate: 100,
type: "CAFE",
name: "카페1",
walkingTime: 5
Expand All @@ -50,7 +50,7 @@ extension Spots {
),
Spot(
image: .imgEx3,
matchingRate: 80,
matchingRate: 5,
type: "RESTAURANT",
name: "햄버거 가게3",
walkingTime: 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import Foundation

enum SpotListItemSizeType {

case minimumLineSpacing, itemWidth
case minimumLineSpacing, itemWidth, headerHeight

var value: CGFloat {
switch self {
case .minimumLineSpacing: return 12
case .itemWidth: return ScreenUtils.width - 40
case .headerHeight: return 38
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SpotListCollectionViewCell: BaseCollectionViewCell {
// MARK: - UI Properties

private let bgImage = UIImageView()
private let dimImage = UIImageView()

private let matchingRateView = UIView()
private let matchingRateLabel = UILabel()
Expand All @@ -35,6 +36,7 @@ class SpotListCollectionViewCell: BaseCollectionViewCell {
super.setHierarchy()

self.addSubviews(bgImage,
dimImage,
matchingRateView,
stackView)

Expand All @@ -53,12 +55,20 @@ class SpotListCollectionViewCell: BaseCollectionViewCell {
override func setLayout() {
super.setLayout()

let horizontalSpace = ScreenUtils.width * 16 / 360
let verticalSpace = ScreenUtils.height * 16 / 780

bgImage.snp.makeConstraints {
$0.edges.equalToSuperview()
}

dimImage.snp.makeConstraints {
$0.edges.equalTo(bgImage)
}

matchingRateView.snp.makeConstraints {
$0.leading.top.equalToSuperview().offset(16)
$0.leading.equalToSuperview().offset(horizontalSpace)
$0.top.equalToSuperview().offset(verticalSpace)
$0.width.equalTo(96)
$0.height.equalTo(22)
}
Expand All @@ -68,7 +78,8 @@ class SpotListCollectionViewCell: BaseCollectionViewCell {
}

stackView.snp.makeConstraints {
$0.leading.bottom.equalToSuperview().inset(16)
$0.leading.equalToSuperview().inset(horizontalSpace)
$0.bottom.equalToSuperview().inset(verticalSpace)
}

walkingIcon.snp.makeConstraints {
Expand All @@ -80,9 +91,15 @@ class SpotListCollectionViewCell: BaseCollectionViewCell {
backgroundColor = .clear

bgImage.do {
$0.clipsToBounds = true
$0.contentMode = .scaleAspectFill
$0.layer.cornerRadius = 6
}

dimImage.do {
$0.clipsToBounds = true
$0.image = .dimGra2
$0.layer.cornerRadius = 6
}

matchingRateView.do {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// SpotListCollectionViewHeader.swift
// ACON-iOS
//
// Created by 김유림 on 1/15/25.
//

import UIKit

class SpotListCollectionViewHeader: UICollectionReusableView {

// MARK: - Properties

static let identifier: String = String(describing: SpotListCollectionViewHeader.self)


// MARK: - UI Properties

private let titleLabel = UILabel()


// MARK: - Life Cycle

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

setHierarchy()
setLayout()
setStyle()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func setHierarchy() {
self.addSubview(titleLabel)
}

func setLayout() {
titleLabel.snp.makeConstraints {
$0.horizontalEdges.equalToSuperview().inset(20)
$0.top.equalToSuperview()
$0.bottom.equalToSuperview().offset(-12)
}
}

func setStyle() {
backgroundColor = .clear
let title = StringLiterals.SpotList.headerTitle
titleLabel.setLabel(text: title, style: .h7)
}

}
40 changes: 36 additions & 4 deletions ACON-iOS/ACON-iOS/Presentation/SpotList/View/SpotListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,36 @@ class SpotListView: BaseView {
collectionViewLayout: UICollectionViewFlowLayout()
)

private let footerLabel = UILabel()


// MARK: - LifeCycles

override func setHierarchy() {
super.setHierarchy()

self.addSubviews(collectionView)
self.addSubviews(footerLabel,
collectionView)
}

override func setLayout() {
super.setLayout()

footerLabel.snp.makeConstraints {
$0.bottom.equalTo(self.safeAreaLayoutGuide).offset(-40)
$0.horizontalEdges.equalTo(self.safeAreaLayoutGuide)
}

collectionView.snp.makeConstraints {
$0.edges.equalToSuperview()
$0.top.equalTo(self.safeAreaLayoutGuide).offset(18)
$0.horizontalEdges.bottom.equalTo(self.safeAreaLayoutGuide)
}
}

override func setStyle() {
super.setStyle()

setFooterLabel()
setCollectionView()
}

Expand All @@ -44,7 +54,17 @@ class SpotListView: BaseView {

// MARK: - UI Settings

extension SpotListView {
private extension SpotListView {

func setFooterLabel() {
let text = StringLiterals.SpotList.footerText
footerLabel.setLabel(
text: text,
style: .b4,
color: .gray5,
alignment: .center
)
}

func setCollectionView() {
let flowLayout = UICollectionViewFlowLayout()
Expand All @@ -53,9 +73,21 @@ extension SpotListView {
flowLayout.scrollDirection = .vertical

collectionView.do {
$0.backgroundColor = .gray9
$0.backgroundColor = .clear
$0.setCollectionViewLayout(flowLayout, animated: true)
}
}

}


// MARK: - Binding

extension SpotListView {

func hideFooterLabel(isHidden: Bool) {
footerLabel.isHidden = isHidden
print("hideFooterLabel called.")
}

}
Loading

0 comments on commit a50e617

Please sign in to comment.