2026-02-11 17:46:34 +01:00
|
|
|
import SwiftData
|
|
|
|
|
|
2026-02-11 18:04:36 +01:00
|
|
|
/// Extends ModelContext to conform to the TodoRepository protocol.
|
2026-02-11 17:46:34 +01:00
|
|
|
///
|
2026-02-11 18:04:36 +01:00
|
|
|
/// This extension allows ModelContext from SwiftData to be used as a todo repository,
|
2026-02-11 17:46:34 +01:00
|
|
|
/// enabling dependency injection and facilitating unit testing by allowing mock
|
|
|
|
|
/// repositories to be substituted during tests.
|
2026-02-11 18:04:36 +01:00
|
|
|
///
|
|
|
|
|
/// The ModelContext methods `delete(_:)` and `insert(_:)` already match the
|
|
|
|
|
/// TodoRepository protocol requirements, so this extension simply declares conformance
|
|
|
|
|
/// without requiring additional implementation.
|
|
|
|
|
extension ModelContext: TodoRepository {}
|