Last active
February 7, 2019 11:49
-
-
Save dimebt/93b41e3f94c45b7233c50573f9f874b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let backgroundQueue = DispatchQueue.global(qos: .background) | |
firstly { | |
showLoader() | |
}.then(on: backgroundQueue) { | |
self.fetchJSON() | |
}.then(on: backgroundQueue) { (photos) in | |
self.downloadPhotos(photos: Array(photos.prefix(40))) | |
}.done(on: DispatchQueue.main, flags: nil) { _ in | |
self.hideLoader() | |
self.photoCollectionView.reloadData() | |
}.catch { (error) in | |
print(error.localizedDescription) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment