Adding a progress bar to upload or download
When we have a large upload or download, we generally want to have a progress indicator that we can show to the users so that they have an idea of how much longer the upload or download will take. The MKNetworkKit makes showing a progress indicator incredibly easy.
In this recipe we will be adding a progress indicator that will show the progress of downloading a large file. We will be using the onDownloadProgressChanged:
callback of the MKNetworkOperation
class to track the progress of our download. If we want the progress indicator to work for an upload, we need to use the onUploadProgressChanged:
callback.
Getting ready
This recipe is compatible with both iOS and OS X. We need to download the framework from https://github.com/MugunthKumar/MKNetworkKit and add it to our project. Additionally, we need to add the following four frameworks:
ImageIO.framework
Security.framework
SystemConfiguration.framework
CFNetwork.framework
How to do it…
Let's create the...