List tasks feature #4
@@ -37,48 +37,45 @@ struct SampleTaskDataModifier: PreviewModifier {
|
|||||||
)
|
)
|
||||||
|
|
||||||
let calendar: Calendar = .current
|
let calendar: Calendar = .current
|
||||||
let today: Date = .now
|
|
||||||
let tomorrow: Date = calendar.date(byAdding: .day, value: 1, to: today) ?? today
|
|
||||||
let yesterday = calendar.date(byAdding: .day, value: -1, to: today) ?? today
|
|
||||||
|
|
||||||
let tasks: [Todo] = [
|
let tasks: [Todo] = [
|
||||||
.init(
|
.init(
|
||||||
title: "Today task 1",
|
title: "Today task #1",
|
||||||
due: today
|
due: .now
|
||||||
),
|
),
|
||||||
.init(
|
.init(
|
||||||
title: "Today task 2",
|
title: "Today task #2",
|
||||||
note: "This is some random note attached to the task.",
|
note: "This is some random note attached to the task.",
|
||||||
due: today
|
due: .now
|
||||||
),
|
),
|
||||||
.init(
|
.init(
|
||||||
title: "Tomorrow task",
|
title: "Tomorrow task",
|
||||||
due: tomorrow
|
due: calendar.date(byAdding: .day, value: 1, to: .now) ?? .now
|
||||||
),
|
),
|
||||||
.init(
|
.init(
|
||||||
title: "Next week task",
|
title: "Next week task",
|
||||||
note: "This is some random note attached to the task.",
|
note: "This is some random note attached to the task.",
|
||||||
due: calendar.date(byAdding: .day, value: 7, to: today) ?? today
|
due: calendar.date(byAdding: .day, value: 7, to: .now) ?? .now
|
||||||
),
|
),
|
||||||
.init(
|
.init(
|
||||||
title: "Yesterday task",
|
title: "Yesterday task",
|
||||||
due: yesterday
|
due: calendar.date(byAdding: .day, value: -1, to: .now) ?? .now
|
||||||
),
|
),
|
||||||
.init(
|
.init(
|
||||||
title: "Last week task",
|
title: "Last week task",
|
||||||
note: "This is some random note attached to the task.",
|
note: "This is some random note attached to the task.",
|
||||||
due: calendar.date(byAdding: .day, value: -7, to: today) ?? today
|
due: calendar.date(byAdding: .day, value: -7, to: .now) ?? .now
|
||||||
),
|
),
|
||||||
.init(
|
.init(
|
||||||
title: "Completed task 1",
|
title: "Completed task #1",
|
||||||
due: today,
|
due: calendar.date(byAdding: .day, value: 1, to: .now) ?? .now,
|
||||||
completed: today
|
completed: .now
|
||||||
),
|
),
|
||||||
.init(
|
.init(
|
||||||
title: "Completed task 2",
|
title: "Completed task #2",
|
||||||
note: "This is some random note attached to the task.",
|
note: "This is some random note attached to the task.",
|
||||||
due: yesterday,
|
due: calendar.date(byAdding: .day, value: -1, to: .now) ?? .now,
|
||||||
completed: today
|
completed: .now
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user