Reputation: 146
I have two viewControllers VCList(CollectionView with items) VCDetails by selecting item from VCList it opens VCDetails, on VCDetails I have button download that starts downloading huge file according selected item with showing its progress, by dismissing VCDetails I want to show progress on VCDetails, and on entering again on that VCDetails if its is still downloading I want to show continued progress of downloading. Please any suggestions on how to achieve this? Thanks a lot
Upvotes: 0
Views: 226
Reputation: 131436
This sounds like a loosely coupled notification. I would suggest having your download process broadcast Notification
messages to the main thread at modest intervals (every few seconds). Then have the current view controller subscribe to those notifications and use them to update a download progress indicator.
Better yet, create a reusable download progress indicator that takes a download ID and listens for progress updates. Have your download manager return a unique download ID, and pass that to the view controllers that need to display progress. Have the view controllers install the download ID into their reusable download indicators views.
Upvotes: 1