Created
May 15, 2019 23:01
-
-
Save aybekckaya/d7e52cc0e6dd2d13b24eca2205d198cf 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
| guard let jsonDct:[String:Any] = readJsonFile() , let arrCategoriesDct:[[String:Any]] = jsonDct["categories"] as? [[String:Any]] else { return } | |
| let categories:[Category] = arrCategoriesDct.compactMap { dct -> Category? in | |
| return Category(dct: dct) | |
| } | |
| var completedCount:Int = 0 | |
| categories.forEach { category in | |
| self.asyncTask(imageURL: category.thumbnailImage, completion: { image in | |
| completedCount += 1 | |
| if completedCount == categories.count { | |
| print("Finished All Tasks") | |
| } | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment