Skip to content

Instantly share code, notes, and snippets.

@srdanrasic
Last active February 10, 2018 15:53
Show Gist options
  • Save srdanrasic/4dcc75cb62a9dc5045914dfaff661cfc to your computer and use it in GitHub Desktop.
Save srdanrasic/4dcc75cb62a9dc5045914dfaff661cfc to your computer and use it in GitHub Desktop.
extension ProfileViewController {
static func makeViewController(_ userService: UserService) -> ProfileViewController {
let viewController = ProfileViewController()
viewController.nameLabel.text = userService.user.name
viewController.imageView.imageUrl = userService.user.imageUrl // Assuming using an image caching libary
userService.friends.bind(to: viewController.friendsView) { cell, friend in
cell.nameLabel.text = friend.name
}
// ...
return viewController
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment