Skip to content

Instantly share code, notes, and snippets.

@seyitcodeit
Last active July 6, 2021 18:46
Show Gist options
  • Save seyitcodeit/6b48cfa56103429f179dce59f40b21b7 to your computer and use it in GitHub Desktop.
Save seyitcodeit/6b48cfa56103429f179dce59f40b21b7 to your computer and use it in GitHub Desktop.
Builder Pattern example for Medium Post
struct Builder {
func makeNewsViewController() -> UIViewController {
let cameraProvider = CameraDataProvider()
let commentorProvider = CommentorDataProvider()
let moderatorProvider = ModeratorDataProvider()
let tableProvider = TableDataProvider()
let useCase = MyUseCase(
cameraProvider: cameraProvider,
commentorProvider: commentorProvider,
moderatorProvider: moderatorProvider,
tableProvider: tableProvider
)
let locationHandler = LocationAuthorizationHandler()
let viewModel = NewsViewModel(useCase: useCase)
return NewsViewController(viewmodel: viewModel, locationHandler: locationHandler)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment