Created
April 23, 2019 15:09
-
-
Save ashour/b6069f1d3caaf1528f80aee8fd9248c4 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
// ... | |
var productListener: Product.Listener? | |
fileprivate var products: [Product] = [] | |
{ | |
didSet | |
{ | |
feedTableView.reloadData() | |
} | |
} | |
override func viewWillAppear(_ animated: Bool) | |
{ | |
super.viewWillAppear(animated) | |
productListener = Product.listenToFeed | |
{ | |
[unowned self] in self.products = $0 | |
} | |
} | |
override func viewWillDisappear(_ animated: Bool) | |
{ | |
super.viewWillDisappear(animated) | |
productListener?.remove() | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment