Skip to content

Instantly share code, notes, and snippets.

@chrsp
Last active July 18, 2022 15:24
Show Gist options
  • Save chrsp/1ce93ca1a1b2e25dc9a9022627fca018 to your computer and use it in GitHub Desktop.
Save chrsp/1ce93ca1a1b2e25dc9a9022627fca018 to your computer and use it in GitHub Desktop.
// Module: Data
import Domain
public struct KitchenLocalDataSource: KitchenLocalRepository {
public func getIngredients(_ recipe: Recipe) -> [Ingredient]? {
// do something to fetch the ingredients needed from some local store: UserDefaults, CoreData, Memory Cache, KeychainManager etc
}
}
public struct KitchenRemoteDataSource: KitchenRemoteRepository {
public func getIngredients(_ recipe: Recipe, completion: ([Ingredient]?) -> Void)) {
// do something to fetch the ingredients needed from some remote store, usually calling your NetworkManager here
}
}
@harshadeepak11
Copy link

Thanks a lot for quick reply sir.
I am still a bit confused in Importing, It would be really helpful for me if you could please send me the finished project possibly.
Here I am - [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment