Relative Content

Tag Archive for iosswiftpass-data

How do I pass data to another ViewController without presenting said ViewController?

I am building an app that fetches pictures from a nasa API and then shows it a CollectionView as well as in a UITableView. My app is driven by a UITabBarController which has an array of three view controllers.
HomeViewController((): This is where the app defaults to when it initially launches, this viewcontroller shows the latest picture retrieved from the API, i.e today’s date. I have a button here that when clicked, should send the latest photo being displayed to the FavoriteViewController(), but without presenting it that viewcontroller. And so far it only works if I also present this VC, and if I don’t, the data isn’t being sent.