Files
javier ac0e0f6556 Manual task reordering feature (#6)
This PR contains the work done to add support for manual todo task reordering in the *Task list* view

Reviewed-on: rock-n-code/todos-app#6
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2026-02-11 15:28:22 +00:00

49 lines
1.2 KiB
Swift

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?
/// The display order of the todo task.
var order: Int
/// 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.
/// - order: The display order of the todo task.
init(
title: String,
note: String? = nil,
due: Date,
completed: Date? = nil,
order: Int = 0
) {
self.completed = completed
self.due = due
self.note = note
self.order = order
self.title = title
}
}