Last active
February 10, 2018 20:02
-
-
Save srdanrasic/7e02198085ed3083f29e8e4ff766edaa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| } | |
| viewController.logoutButton.reactive.tap | |
| .observeNext(with: userService.logOut) | |
| .dispose(in: viewController.bag) | |
| return viewController | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment