Skip to content

Instantly share code, notes, and snippets.

View muhammadbassio's full-sized avatar

Muhammad Bassio muhammadbassio

View GitHub Profile
@muhammadbassio
muhammadbassio / code.swift
Last active October 13, 2016 10:01
increment number using async calls in for loop
// get number of files before starting.
var getNumberFull = DealWithFileSystem.fetchNumberOfFilesInFolder(folderName: "Folder2")
for asset in self.arrayOfSelectAssets {
if let getNumberFromThumb = DealWithFileSystem.fetchNumberOfFilesInFolder(folderName: "Folder1") {
let filePathThumb = DealWithFileSystem.fetchFolderName(folderName: "Folder1")?.appendingPathComponent("Image \(getNumberFromThumb).png")
let fetchOption = PHImageRequestOptions()
fetchOption.isSynchronous = true
fetchOption.deliveryMode = .highQualityFormat
PHImageManager.default().requestImage(for: asset, targetSize: CGSize(width:130,height:130), contentMode: .aspectFit, options: fetchOption, resultHandler: { (img, nil) in
if let convert = UIImagePNGRepresentation(img!) {