Skip to content

Commit ec79aad

Browse files
committed
[feat] quest view header view change
1 parent 7636c1a commit ec79aad

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

DailyQuest/DailyQuest/Presentation/Common/View/QuestViewHeader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class QuestViewHeader: UIStackView {
1818
// MARK: - Components
1919
private(set) lazy var titleLabel: UILabel = {
2020
let titleLabel = UILabel()
21-
titleLabel.text = "Today Quests"
21+
titleLabel.text = "오늘의 퀘스트"
2222
titleLabel.textColor = .maxViolet
2323
titleLabel.font = UIFont.boldSystemFont(ofSize: 32)
2424

DailyQuest/DailyQuest/Presentation/Home/ViewModel/HomeViewModel.swift

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ final class HomeViewModel {
9494
.do(onNext: { [weak self] date in
9595
self?.currentDate = date
9696
})
97-
.flatMap(questUseCase.fetch(by:))
98-
.asDriver(onErrorJustReturn: [])
97+
.flatMap(questUseCase.fetch(by:))
98+
.asDriver(onErrorJustReturn: [])
9999

100-
let userNotification = NotificationCenter
101-
.default
102-
.rx
103-
.notification(.userUpdated)
104-
.map { _ in Date() }
100+
let userNotification = NotificationCenter
101+
.default
102+
.rx
103+
.notification(.userUpdated)
104+
.map { _ in Date() }
105105

106106
let userData = Observable
107107
.merge(
@@ -194,13 +194,10 @@ final class HomeViewModel {
194194
private extension HomeViewModel {
195195
func calculateRelative(_ date: Date) -> String {
196196
let today = Date()
197-
198-
if today.startOfDay > date.startOfDay {
199-
return "Previous Quests"
200-
} else if today.startOfDay < date.startOfDay {
201-
return "Upcomming Quests"
197+
if today.startOfDay == date.startOfDay {
198+
return "오늘의 퀘스트"
202199
} else {
203-
return "Today Quests"
200+
return "\(date.toFormatMonthDay)의 퀘스트 "
204201
}
205202
}
206203
}

DailyQuest/DailyQuest/Utils/Date+.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ extension Date {
1919
dateFormatter.dateFormat = "yyyy년 MM월"
2020
return dateFormatter.string(from: self)
2121
}
22+
23+
var toFormatMonthDay: String {
24+
let dateFormatter = DateFormatter()
25+
dateFormatter.dateFormat = "MM월 dd일"
26+
return dateFormatter.string(from: self)
27+
}
2228
}
2329

2430
extension Date {

0 commit comments

Comments
 (0)