Files
todos/App/Sources/View Models/ContentViewModel.swift
T

40 lines
1.0 KiB
Swift
Raw Normal View History

2026-02-09 17:53:40 +00:00
import SwiftData
import SwiftUI
extension ContentView {
/// View model for managing the logic for the content view.
///
/// This observable class encapsulates the state and business logic for the main content view.
/// It follows the MVVM pattern to separate presentation logic from the view layer.
///
/// The view model manages:
/// - Presentation state for the new task view within a sheet.
@Observable
2026-02-10 02:22:41 +00:00
final class ViewModel {
2026-02-09 17:53:40 +00:00
// MARK: Properties
/// Whether the new task view should be shown.
var newTaskShown: Bool
// MARK: Initialization
/// Initializes a new view model instance with default values.
///
/// The view model is initialized with:
/// - New task view hidden
init() {
newTaskShown = false
}
// MARK: Functions
/// Shows the new task view by setting the presentation state to true.
func showNewTask() {
newTaskShown = true
}
}
}