Files

49 lines
1.2 KiB
Swift
Raw Permalink Normal View History

2026-02-09 17:53:40 +00:00
import Foundation
import SwiftData
/// Represents a todo task created by a user.
@Model
final class Todo {
// MARK: Properties
/// A date when the todo was completed, if applicable.
var completed: Date?
/// A date by which the todo should be completed.
var due: Date
/// An optional note providing additional details about the todo task.
var note: String?
2026-02-11 15:28:22 +00:00
/// The display order of the todo task.
var order: Int
2026-02-09 17:53:40 +00:00
/// The title of the todo task.
var title: String
// MARK: Initializers
/// Creates a new todo item.
/// - Parameters:
/// - title: The title of the todo item.
/// - note: An optional note providing additional details.
/// - due: The date by which the todo should be completed.
/// - completed: The date when the todo was completed, if applicable.
2026-02-11 15:28:22 +00:00
/// - order: The display order of the todo task.
2026-02-09 17:53:40 +00:00
init(
title: String,
note: String? = nil,
due: Date,
2026-02-11 15:28:22 +00:00
completed: Date? = nil,
order: Int = 0
2026-02-09 17:53:40 +00:00
) {
self.completed = completed
self.due = due
self.note = note
2026-02-11 15:28:22 +00:00
self.order = order
2026-02-09 17:53:40 +00:00
self.title = title
}
}