A user adds an item to their bag. As soon as the item is added to the bag, we make a network call to make sure that item is still available.The network call takes a few second to complete in the background. 

When an item is added to the cart, it is stored in a singleton that can be accessed from anywhere in the app. Like this: 

```
static let shared = Cart()    
var products = [Product]()

```

When the network call returns and the product is unavailable, we remove it from the singleton. This causes an issue if the cart VC was opened during the network call because the table view needs to be reloaded. For that reason, we need to check if the VC that is visible is the cart VC and reload the table view. I would also like to check if the CartVC is in memory and reload the table view. Because if the cart VC is in memory and below another VC then it will also have bad data and when the user closes the VC on top, they will see bad data. How would I do that?

Before this is marked as a duplicate, I did check other posts and none of them work very well. There is also a lot of methods to do this and I would like to know which is best in swift 3.