Skip to content

Commit 6befaf3

Browse files
committed
feat: FeedViewController Calendar UI 추가 개발
1 parent bb0932c commit 6befaf3

2 files changed

Lines changed: 75 additions & 2 deletions

File tree

Projects/Feature/Feed/Sources/Presentation/FeedViewController.swift

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public final class FeedViewController: UIViewController, View {
1616

1717
private let groupHeaderView = UIView()
1818
private let groupButton = FeedGroupButton()
19-
19+
private let weekCalendarView = FeedWeekCalendarView()
20+
2021
let dimmedControl = UIControl()
2122
let floatingActionButtonOverlayView = UIView()
2223
let expandedButtonStackView = UIStackView()
@@ -144,12 +145,46 @@ public final class FeedViewController: UIViewController, View {
144145
)
145146
}
146147
.disposed(by: disposeBag)
148+
149+
bindWeekCalendar(reactor)
150+
}
151+
}
152+
153+
private extension FeedViewController {
154+
func bindWeekCalendar(_ reactor: FeedReactor) {
155+
weekCalendarView.onPreviousWeekTap = { [weak reactor] in
156+
reactor?.action.onNext(.didTapPreviousWeek)
157+
}
158+
159+
weekCalendarView.onNextWeekTap = { [weak reactor] in
160+
reactor?.action.onNext(.didTapNextWeek)
161+
}
162+
163+
weekCalendarView.onDateTap = { [weak reactor] model in
164+
reactor?.action.onNext(.didTapCalendarDate(model))
165+
}
166+
167+
reactor.state
168+
.map(\.weekCalendarViewState)
169+
.distinctUntilChanged()
170+
.observe(on: MainScheduler.instance)
171+
.bind(with: self) { owner, viewState in
172+
owner.weekCalendarView.configure(
173+
title: viewState.calendarTitle,
174+
dates: viewState.calendarDates,
175+
canMovePrevious: viewState.canMovePreviousWeek,
176+
canMoveNext: viewState.canMoveNextWeek,
177+
todayDate: viewState.todayDate,
178+
selectedDate: viewState.selectedDate
179+
)
180+
}
181+
.disposed(by: disposeBag)
147182
}
148183
}
149184

150185
private extension FeedViewController {
151186
func setupUI() {
152-
view.backgroundColor = .systemBackground
187+
view.backgroundColor = .systemWhite
153188
groupHeaderView.backgroundColor = .systemWhite
154189
dimmedControl.backgroundColor = .systemBlack.withAlphaComponent(0.6)
155190

@@ -161,6 +196,7 @@ private extension FeedViewController {
161196
func setupLayout() {
162197
configureGroupHeaderLayout()
163198
configureFloatingActionButtonLayout()
199+
configureWeekCalendarLayout()
164200
}
165201

166202
func configureGroupHeaderLayout() {
@@ -185,4 +221,13 @@ private extension FeedViewController {
185221
$0.size.equalTo(56)
186222
}
187223
}
224+
225+
func configureWeekCalendarLayout() {
226+
view.addSubview(weekCalendarView)
227+
228+
weekCalendarView.snp.makeConstraints {
229+
$0.top.equalTo(groupHeaderView.snp.bottom)
230+
$0.leading.trailing.equalToSuperview()
231+
}
232+
}
188233
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// FeedWeekCalendarViewState.swift
3+
// Feed
4+
//
5+
// Created by 김동준 on 7/14/26.
6+
//
7+
8+
struct FeedWeekCalendarViewState: Equatable {
9+
let calendarTitle: String
10+
let calendarDates: [FeedWeekCalendarModel]
11+
let canMovePreviousWeek: Bool
12+
let canMoveNextWeek: Bool
13+
let todayDate: String
14+
let selectedDate: String
15+
}
16+
17+
extension FeedReactor.State {
18+
var weekCalendarViewState: FeedWeekCalendarViewState {
19+
FeedWeekCalendarViewState(
20+
calendarTitle: calendarTitle,
21+
calendarDates: calendarDates,
22+
canMovePreviousWeek: canMovePreviousWeek,
23+
canMoveNextWeek: canMoveNextWeek,
24+
todayDate: todayDate,
25+
selectedDate: selectedDate
26+
)
27+
}
28+
}

0 commit comments

Comments
 (0)