From e645b9b4b5b0a0ca439ea8767da8d8f2796668de Mon Sep 17 00:00:00 2001 From: sunflower Date: Wed, 3 Nov 2021 22:11:19 +0900 Subject: [PATCH 1/4] =?UTF-8?q?Feat:=20TagButton=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RoomList/Views/TagButton.swift | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift diff --git a/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift b/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift new file mode 100644 index 0000000..1eb0f07 --- /dev/null +++ b/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift @@ -0,0 +1,44 @@ +// +// TagButton.swift +// Escaper +// +// Created by shinheeRo on 2021/11/03. +// + +import UIKit + +class TagButton: UIButton { + + private(set) var element: Tagable? + + required init?(coder: NSCoder) { + super.init(coder: coder) + self.configure() + } + + override init(frame: CGRect) { + super.init(frame: frame) + self.configure() + } + + convenience init(element: Tagable) { + self.init(frame: .zero) + self.element = element + self.setTitle(element.name, for: .normal) + } + + private func configure() { + self.layer.cornerRadius = 5 + self.titleLabel?.textColor = UIColor(named: ColorPalette.skullWhite.code) + self.untouched() + } + + func touched() { + self.backgroundColor = UIColor(named: ColorPalette.pumpkin.code) + } + + func untouched() { + self.backgroundColor = UIColor(named: ColorPalette.bloodyDarkBurgundy.code) + } + +} From 13804051f2ce1494a2bac541ae00fe6dd541f121 Mon Sep 17 00:00:00 2001 From: sunflower Date: Wed, 3 Nov 2021 22:12:52 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Feat:=20ColorPalette=EC=97=90=20=EC=83=89?= =?UTF-8?q?=EC=83=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Escaper/Escaper/Common/Library/ColorPalette.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Escaper/Escaper/Common/Library/ColorPalette.swift b/Escaper/Escaper/Common/Library/ColorPalette.swift index d7b92c9..a0f09c7 100644 --- a/Escaper/Escaper/Common/Library/ColorPalette.swift +++ b/Escaper/Escaper/Common/Library/ColorPalette.swift @@ -10,6 +10,7 @@ import Foundation enum ColorPalette { case bloodyBlack case bloodyBurgundy + case bloodyDarkBurgundy case bloodyRed case charcoal case gloomyPink From 5069567544d3a7d5bc392374457ba672bb0ea677 Mon Sep 17 00:00:00 2001 From: sunflower Date: Wed, 3 Nov 2021 22:17:02 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Feat:=20Tagable=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=86=A0=EC=BD=9C=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Escaper/Escaper/Domain/DataStruct/Genre.swift | 7 ++++++- .../Escaper/Domain/DataStruct/SortingOption.swift | 2 +- Escaper/Escaper/Domain/Protocol/Tagable.swift | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 Escaper/Escaper/Domain/Protocol/Tagable.swift diff --git a/Escaper/Escaper/Domain/DataStruct/Genre.swift b/Escaper/Escaper/Domain/DataStruct/Genre.swift index 64e15fc..faa6ef0 100644 --- a/Escaper/Escaper/Domain/DataStruct/Genre.swift +++ b/Escaper/Escaper/Domain/DataStruct/Genre.swift @@ -7,7 +7,12 @@ import Foundation -enum Genre: String, Codable { +enum Genre: String, Tagable, CaseIterable, Codable { + + var name: String { + return self.rawValue + } + case all = "전체" case history = "역사" case fear = "공포" diff --git a/Escaper/Escaper/Domain/DataStruct/SortingOption.swift b/Escaper/Escaper/Domain/DataStruct/SortingOption.swift index e820571..2fecbaa 100644 --- a/Escaper/Escaper/Domain/DataStruct/SortingOption.swift +++ b/Escaper/Escaper/Domain/DataStruct/SortingOption.swift @@ -7,7 +7,7 @@ import Foundation -enum SortingOption: String { +enum SortingOption: String, Tagable, CaseIterable { case satisfaction = "만족도순" case level = "난이도순" case distance = "거리순" diff --git a/Escaper/Escaper/Domain/Protocol/Tagable.swift b/Escaper/Escaper/Domain/Protocol/Tagable.swift new file mode 100644 index 0000000..69678f2 --- /dev/null +++ b/Escaper/Escaper/Domain/Protocol/Tagable.swift @@ -0,0 +1,12 @@ +// +// Tagable.swift +// Escaper +// +// Created by shinheeRo on 2021/11/03. +// + +import Foundation + +protocol Tagable { + var name: String { get } +} From fc2c2ba38ce9aaf079e988d3f12aa504a877f034 Mon Sep 17 00:00:00 2001 From: sunflower Date: Wed, 3 Nov 2021 22:41:27 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Style:=20TagButton=20class=EC=97=90=20final?= =?UTF-8?q?=20=ED=82=A4=EC=9B=8C=EB=93=9C=20=EC=B6=94=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift b/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift index 1eb0f07..23b1bed 100644 --- a/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift +++ b/Escaper/Escaper/Presentation/RoomList/Views/TagButton.swift @@ -7,7 +7,7 @@ import UIKit -class TagButton: UIButton { +final class TagButton: UIButton { private(set) var element: Tagable?