I am building a SwiftUI app that pulls information from a local .SQLite database (using the SQLite.swift wrapper from https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md). I need to build a repository that sits between the View Service and the Database Manager. I am very new to repository pattern, and am struggling to find 1) documentation for using repository pattern in Swift 5, and 2) what exactly needs to be in the repository. I found this example for using repository pattern in Swift, but it uses a web-based API for its code examples, and I can't find anything for use with a local db. Code below is what I have in the repository so far:
struct doMaster: Codable {
let doID: Int64
let doName: String
let doState: Bool
let doCompletedState: Bool
let doCategory: String
}
struct doDescription: Codable {
let doID: Int64
let doDescription: String
}
struct doStreaks: Codable {
let doID: Int64
let doStreak: Int64
}
struct doCategories: Codable {
let category: String
let categoryColor: String
}
class LocalRepository {
let path: String = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first ?? ""
let task =
}
Any help would be very much appreciated. Thank you in advance!