I have a tableview which download pictures of restaurants menu which range from 200 Kilobytes to 2 MB using kingFisher pod.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MealCell", for: indexPath) as! MealTableViewCell
let defaultImage = UIImage(named: "DefaultMeal")
cell.mealImageView.kf.setImage(with: url, placeholder: defaultImage, options: [.transition(.fade(0.3))])
bla bla bla...
return cell
}
I am not using prefetching , and I don't think if my problem is related to prefetching.
My main problem is when coming to a restaurant menu that is around 800 kb , the download process is start to be very slow.
And when scroll down very fast I have to wait around 1-2 minute for all my pics to download which comparing to my server upload speed and my home download speed is pretty far away.
I started searching everywhere for the same issue but I didn't find any.
I used this code increase downloader timeout and it worked for the images that stops downloading at all.
KingfisherManager.shared.downloader.downloadTimeout = 600
And also when open network tab of Xcode debugger, I realize that my app is depending on just one TCP connection and as below picture, it only uses 73 KB/s for that big images.
I Also tried this but the problem still where the Downloading is still depend in just one connection.
KingfisherManager.shared.downloader.sessionConfiguration.httpMaximumConnectionsPerHost = 8
What Exactly I am doing wrong, is there any way to download it faster.
Any help will be appreciated.