Renamed the Repository protocol in the app target as TodoRepository.
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
import SwiftData
|
||||
|
||||
/// Extends ModelContext to conform to the Repository protocol.
|
||||
/// Extends ModelContext to conform to the TodoRepository protocol.
|
||||
///
|
||||
/// This extension allows ModelContext from SwiftData to be used as a repository,
|
||||
/// This extension allows ModelContext from SwiftData to be used as a todo repository,
|
||||
/// enabling dependency injection and facilitating unit testing by allowing mock
|
||||
/// repositories to be substituted during tests.
|
||||
extension ModelContext: Repository {}
|
||||
///
|
||||
/// 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 {}
|
||||
|
||||
Reference in New Issue
Block a user