Skip to content

Commit 610d185

Browse files
committed
feat: 스와이프로 complete 구현
1 parent 4191160 commit 610d185

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 SectionStore {
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+
) -> SectionStore {
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 SectionStore(
308308
focused: items.filter(\.isPinned),
309309
unscheduled: items.filter { !$0.isPinned && $0.dueDate == nil }
310310
)
311311
}
312312

313-
var buckets = SectionBuckets()
313+
var store = SectionStore()
314314

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

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

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

336-
return buckets
336+
return store
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) {
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)