diff --git a/DevLog/Presentation/ViewModel/TodayViewModel.swift b/DevLog/Presentation/ViewModel/TodayViewModel.swift index 6ce7a620..b339a74f 100644 --- a/DevLog/Presentation/ViewModel/TodayViewModel.swift +++ b/DevLog/Presentation/ViewModel/TodayViewModel.swift @@ -22,7 +22,7 @@ final class TodayViewModel: Store { let items: [TodayTodoItem] } - struct SectionBuckets { + struct SectionCollection { var focused: [TodayTodoItem] = [] var overdue: [TodayTodoItem] = [] var dueSoon: [TodayTodoItem] = [] @@ -301,39 +301,39 @@ private extension TodayViewModel { func groupedSectionItems( from items: [TodayTodoItem] - ) -> SectionBuckets { + ) -> SectionCollection { let startOfToday = calendar.startOfDay(for: Date()) guard let windowEnd = calendar.date(byAdding: .day, value: upcomingWindowDays, to: startOfToday) else { - return SectionBuckets( + return SectionCollection( focused: items.filter(\.isPinned), unscheduled: items.filter { !$0.isPinned && $0.dueDate == nil } ) } - var buckets = SectionBuckets() + var collection = SectionCollection() for item in items { if item.isPinned { - buckets.focused.append(item) + collection.focused.append(item) continue } guard let dueDate = item.dueDate else { - buckets.unscheduled.append(item) + collection.unscheduled.append(item) continue } let dueDay = calendar.startOfDay(for: dueDate) if dueDay < startOfToday { - buckets.overdue.append(item) + collection.overdue.append(item) } else if dueDay <= windowEnd { - buckets.dueSoon.append(item) + collection.dueSoon.append(item) } else { - buckets.later.append(item) + collection.later.append(item) } } - return buckets + return collection } func isOverdue(_ item: TodayTodoItem) -> Bool { diff --git a/DevLog/UI/Today/TodayView.swift b/DevLog/UI/Today/TodayView.swift index fe6a4a51..2f65bad8 100644 --- a/DevLog/UI/Today/TodayView.swift +++ b/DevLog/UI/Today/TodayView.swift @@ -156,11 +156,12 @@ struct TodayView: View { Image(systemName: item.isPinned ? "star.slash" : "star.fill") } .tint(.orange) - + } + .swipeActions(edge: .trailing, allowsFullSwipe: false) { Button { viewModel.send(.completeTodo(item)) } label: { - Image(systemName: "checkmark") + Label("완료", systemImage: "checkmark") } .tint(.green) }