Skip to content

Instantly share code, notes, and snippets.

View LucidityDesign's full-sized avatar
🔋
Fully charged

Alexander Scholz LucidityDesign

🔋
Fully charged
View GitHub Profile
class Uploader {
[...]
private func uploadImages() -> Future<Void, UploadError> {
let promise = Promise<Void, UploadError>()
var imageSequence: [Future<Void, UploadError>]! = [] // 1
let queue = OperationQueue() // 2
queue.maxConcurrentOperationCount = 3
for case let image as Image in self.images {
let promise = Promise<Void, UploadError>() // 3
let operation = UploadOperation(image: image, promise: promise)
@LucidityDesign
LucidityDesign / UploadOperation.swift
Last active January 12, 2019 14:46
Use BrightFutures, Alamofire and Operations to queue the upload of multiple images
//
// AsynchronousOperation.swift
//
// Created by Robert Ryan on 9/20/14.
// Copyright (c) 2014 Robert Ryan. All rights reserved.
//
import UIKit
import Alamofire
import BrightFutures