In a modern iPhone app, a smooth user experience is quite important. To achieve this, caching the internet resources to local is a good approach. Therefore, to make the app more smoothly when users open it, downloading images and videos and saving them locally will quite improve the app starting speed. In the last tutorial, I have demonstrated how to download files by Swift 5 and watch the download status such as progress. The downloading task is controlled by 3 buttons: a start button to start, a pause button to pause and resume, a stop button to stop. In this tutorial, I will show how to save the downloaded file in local and open it by default in the iPhone. The whole tutorial is developed under the latest Swift.Read more
Download File in Swift5 Start Pause and Resume
Several years ago, I post an article to demostrate how to implement download file features in iOS. In that article, I am using swift 2 to write all features including start, pause, resume and show progress. Lots of readers ask me to improve a new version with swift4 or swift5. As the language changes a lot, some of the APIs has been deprecated. That’s the reason why I write this artiel. In this article, I will use the latest version of Swift (current version is 5) to show you how to implement download file features.Read more
8 Best iPhone Tips & Tricks to Try
Each year in autumn, Apple has a tradition to surprise its fans with new devices, features, and new operating systems.
Thus Apple devices, including iPhones, have so many features that no matter if you purchased an iPhone yesterday or have been using it for two years, it is very unlikely that you don’t know all of the functionalities of this device.
To help you enjoy your Apple device even more, today, we want to share a list of 8 short tips & tricks about iPhones that you might not have known.Read more
Download Multiple Files Simultaneously in iOS
Downloading multiple files concurrently is a necessary feature for a download manager app. Using UITableView is the best solution to manage multiple downloading tasks at the same time. In a table, we can maintain each separate downloading task in each table row. In this tutorial, I will use UITableView to manage all download threads. In each UITableView cells, I will put a progress bar inside to observe the downloading progress. To control the download task separately, I will also put a start button and pause button in each UITableView cell. Therefore, I will also show you how to custom UITableView cells in this tutorial.
This is the tutorial 3 of iOS download manager app tutorial. In this tutorial, I will give some example to show you how to download multiple files concurrently, and use UITableView to manage each downloading task separately. You can also access the whole tutorial series with following links:
iOS CollectionView Brief Tutorial
UICollectionView is widely used in iOS apps. The most common example is the iOS photo app, which has a stylish way to display all photos in grid view or stack view. The collection view provide a simple way to let us build complicated layout by customising its cell view. Different from table view, collection view will show its cell views in grid layout. Each cell view can have different width and height. Therefore, it gives us more room to make special layout by UICollectionView.
Recently, I am going to create a file manager which will look very similar with iBooks, but will show cover and title altogether with different size. In the future, we can simply use this component in many apps, such as mp3 album app, file download manager app, or comic books app.
Start a Simple App with Collection View
Similar with UITableView and UITableViewCell, the collection view is also made up of UICollectionView and UICollectionViewCell. Additional, we can also customize the layout by setting collectionViewLayout. To build up a grid style view with UICollectionView, we can implement following delegates:
- UICollectionViewDelegate: the delegate set up the collection view.
- UICollectionViewDataSource: the delegate provide the data source for collection view.
- UICollectionViewDelegateFlowLayout (optional): UICollectionView provide us a flow layout. When we use the default layout, we can use this delegate to configure the layout such as size of items and the spacing between items. We can also set collectionViewLayout as our customized layout.