Slide 13
Slide 13 text
protocol FeedRepositoryOutput: class {
func receive(feeds: [Feed])
}
class FeedRepository: FeedDataStoreOutput {
private let dataStore: FeedDataStore
weak var output: FeedRepositoryOutput?
init(dataStore: FeedDataStore, output: FeedRepositoryOutput?) { … }
func getFeeds() {
dataStore.getFeeds()
}
}
extension FeedRepository: FeedDataStoreOutput {
func receive(feeds: [Feed]) {
output?.receive(feeds: feeds)
}
}
Repository patternͷྫ