Hi @Appeloper, in your previous post, you wrote this:
struct Channel: Identifiable, Codable {
let id: String
let name: String
let genre: String
let logo: URL?
// Factory Methods
static var all: [Self] { … }
static var favorites: [Self] { … }
}
My question is, what if you have multiple "source of truth", e.g. when offline, read from coredata, otherwise when online, read from firebase realtime db. If you write these logic inside the model (Channel), wouldn't it violate the purpose of the Model? Or maybe this is just an example, and in real case, you'd create another layer to retrieve the actual data? (Networking or offline storage)?
My concern is: In a decentralize environment, what if you have a model name ChatMessage, you can retrieve this model from different sources (different host urls, different api paths, local storage), how would you design your Model Object?