Skip to content
⚡️ Fast async task based Swift framework with focus on type safety, concurrency and multi threading
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Overdrive.xcodeproj Bound state enum to task base Mar 12, 2017
Sources Bump version to 0.3 Apr 29, 2017
Tests Add necessary protocol method implementations Apr 9, 2017
.gitignore Merge branch docs Nov 13, 2016
.swiftlint.yml [lint] [skip ci] Added type_body_length rule Jul 17, 2016
Package.swift Remove `TestSupport` target Nov 24, 2016

Build Status Plaforms Carthage Compatible Swift Package Manager Compatible Pod version

Our apps constantly do work. The faster you react to user input and produce an output, the more likely is that the user will continue to use your application. As our applications grow in complexity, the more and more work needs to be done. You need to start thinking about how to categorize and optimize work, how to make that work more efficient, more optimized and finally, faster. In most cases that doesn’t end very well because you need to know a lot about concurrency, multithreading etc. - it’s a very complex field. You need to know all API specifics before you are able to write something.

Overdrive was created as a result of that struggle. It is a framework that exposes several simple concepts which are made on top of complex system frameworks that enable multithreading, concurrency and most importantly, more speed.

let task = URLSessionTask(url: "")

  .onValue { json in
  }.onError { error in

TaskQueue.background.add(task: task)


What can I do with Overdrive?

  • Execute tasks concurrently
  • Utilize multi-core systems by default
  • Easily defer task execution to custom thread or queue
  • Ensure that multiple tasks are executed in the correct order
  • Express custom conditions under which tasks can be executed
  • Enforce testability
  • Retry tasks that finished with errors
  • Write thread safe code by default


  • Xcode 8.0+
  • Swift 3
  • Platforms:
    • iOS 8.0+
    • macOS 10.11+
    • tvOS 9.0+
    • watchOS 2.0+
    • Ubuntu



github "arikis/Overdrive" >= 0.3

Cocoa Pods

platform :ios, '8.0'

target 'Your App Target' do
  pod 'Overdrive', '~> 0.3'

Swift Package Manager

import PackageDescription

let package = Package(
  name: "Your Package Name",
  dependencies: [
    .Package(url: "",
             majorVersion: 0,
           minor: 3)

Manual installation

Overdrive can also be installed manually by dragging the Overdrive.xcodeproj to your project and adding Overdrive.framework to the embedded libraries in project settings.


Overdrive features two main classes:


  1. Create subclass of Task<T>
  2. Override run() method and encapsulate any synchronous or asynchronous operation
  3. Finish execution with value(T) or error(Error) by using finish(with:) method
  4. Create instance of subclass
  5. Add it to the TaskQueue when you want to start execution

Example Task<UIImage> subclass for photo download task:

class GetLogoTask: Task<UIImage> {

  override func run() {
    let logoURL = URL(string: "")!

    do {
      let logoData = try Data(contentsOf: logoURL)
      let image = UIImage(data: logoData)!
      finish(with: .value(image)) // Finish with image
    } catch {
      finish(with: .error(error)) // Finish with error if any

To setup completion blocks, you use onValue and onError methods:

let logoTask = GetLogoTask()

  .onValue { logo in
    print(logo) // UIImage object
  }.onError { error in

To execute the task add it to the instance of TaskQueue

let queue = TaskQueue()
queue.add(task: logoTask)


TaskQueue executes tasks concurrently by default. Maximum number of concurrent operations is defined by the current system conditions. If you want to limit the number of maximum concurrent task executions use maxConcurrentTaskCount property.

let queue = TaskQueue()
queue.maxConcurrentTaskCount = 3

Thread safety

All task properties are thread-safe by default, meaning that you can access them from any thread or queue and not worry about locks and access synchronization.


Overdrive framework was heavily inspired by talks and code from several Apple WWDC videos.

Overdrive is a term for an effect used in electric guitar playing that occurs when guitar amp tubes starts to produce overdriven, almost distorted sound, due to the higher gain(master) setting.

Long term plans

This section defines some long term plans for Overdrive. They're not scheduled for implementation or for any specific version.

Remove Foundation.Operation dependency

Currently, Overdrive leverages Foundation.Operation and Foundation.OperationQueue classes for concurrency and execution. While those classes provide excellent functionality, they're still rewrites of their Objective C counterpart (NSOperation and NSOperationQueue). This means that writing Task<T> requires a lot of overrides and state management.

For example, any task subclass must override run() method to define execution point. If this method is not overridden, queue will perform assert to notify that this method should be overridden. Same will happen if is called.

In the future, Overdrive should only use libdispatch for it's functionality.

You can’t perform that action at this time.