Last active
April 18, 2020 09:07
-
-
Save FitzAfful/f0098a8b7da44e515680bc8d68683d72 to your computer and use it in GitHub Desktop.
This file contains 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
import UIKit | |
import Combine | |
class CombineController: UIViewController { | |
@IBOutlet weak var tableView: UITableView! | |
@IBOutlet weak var emptyView: UIView! | |
@IBOutlet weak var activityIndicator: UIActivityIndicatorView! | |
lazy var viewModel: CombineViewModel = { | |
let viewModel = CombineViewModel() | |
return viewModel | |
}() | |
private var cancellables: Set<AnyCancellable> = [] | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
showLoader() | |
setupTableView() | |
bindViewModel() | |
} | |
private func bindViewModel() { | |
viewModel.$employees.sink { [weak self] _ in | |
self?.showTableView() | |
}.store(in: &cancellables) | |
} | |
//... Other delegate methods | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment