Skip to content

Commit 8244767

Browse files
authored
[#312] TodayView에서 Todo를 직접 완료할 수 있는 UI를 구성한다 (#331)
* feat: 스와이프로 complete 구현 * style: 변수 및 타입명 변경 * feat: 풀스와이프 해제
1 parent 4191160 commit 8244767

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

DevLog/Presentation/ViewModel/TodayViewModel.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class TodayViewModel: Store {
2222
let items: [TodayTodoItem]
2323
}
2424

25-
struct SectionBuckets {
25+
struct SectionCollection {
2626
var focused: [TodayTodoItem] = []
2727
var overdue: [TodayTodoItem] = []
2828
var dueSoon: [TodayTodoItem] = []
@@ -301,39 +301,39 @@ private extension TodayViewModel {
301301

302302
func groupedSectionItems(
303303
from items: [TodayTodoItem]
304-
) -> SectionBuckets {
304+
) -> SectionCollection {
305305
let startOfToday = calendar.startOfDay(for: Date())
306306
guard let windowEnd = calendar.date(byAdding: .day, value: upcomingWindowDays, to: startOfToday) else {
307-
return SectionBuckets(
307+
return SectionCollection(
308308
focused: items.filter(\.isPinned),
309309
unscheduled: items.filter { !$0.isPinned && $0.dueDate == nil }
310310
)
311311
}
312312

313-
var buckets = SectionBuckets()
313+
var collection = SectionCollection()
314314

315315
for item in items {
316316
if item.isPinned {
317-
buckets.focused.append(item)
317+
collection.focused.append(item)
318318
continue
319319
}
320320

321321
guard let dueDate = item.dueDate else {
322-
buckets.unscheduled.append(item)
322+
collection.unscheduled.append(item)
323323
continue
324324
}
325325

326326
let dueDay = calendar.startOfDay(for: dueDate)
327327
if dueDay < startOfToday {
328-
buckets.overdue.append(item)
328+
collection.overdue.append(item)
329329
} else if dueDay <= windowEnd {
330-
buckets.dueSoon.append(item)
330+
collection.dueSoon.append(item)
331331
} else {
332-
buckets.later.append(item)
332+
collection.later.append(item)
333333
}
334334
}
335335

336-
return buckets
336+
return collection
337337
}
338338

339339
func isOverdue(_ item: TodayTodoItem) -> Bool {

DevLog/UI/Today/TodayView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,12 @@ struct TodayView: View {
156156
Image(systemName: item.isPinned ? "star.slash" : "star.fill")
157157
}
158158
.tint(.orange)
159-
159+
}
160+
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
160161
Button {
161162
viewModel.send(.completeTodo(item))
162163
} label: {
163-
Image(systemName: "checkmark")
164+
Label("완료", systemImage: "checkmark")
164165
}
165166
.tint(.green)
166167
}

0 commit comments

Comments
 (0)