Skip to content

Instantly share code, notes, and snippets.

@eofster
Created December 15, 2015 13:16
Show Gist options
  • Save eofster/f64963ad90ea717b20a9 to your computer and use it in GitHub Desktop.
Save eofster/f64963ad90ea717b20a9 to your computer and use it in GitHub Desktop.
GPS tracker interactor factory
protocol InteractorFactory {
func createTrackSummaryInteractor(output: TrackSummaryInteractorOutput) -> Interactor
func createTrackNameUpdateInteractor(trackID: Int, name: String) -> Interactor
}
class InteractorFactoryImpl {
let repository: TrackRepository
init(repository: TrackRepository) {
self.repository = repository
}
}
extension InteractorFactoryImpl: InteractorFactory {
func createTrackSummaryInteractor(output: TrackSummaryInteractorOutput) -> Interactor {
return TrackSummaryInteractor(repository: repository, output: output)
}
func createTrackNameUpdateInteractor(trackID: Int, name: String) -> Interactor {
return TrackNameUpdateInteractor(repository: repository)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment