All Projects → JARMourato → Dispatch

JARMourato / Dispatch

Licence: mit
Just a tiny library to make using GCD easier and intuitive

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Dispatch

Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+287.64%)
Mutual labels:  async, multithreading
Actix Net
A collection of lower-level libraries for composable network services.
Stars: ✭ 415 (+133.15%)
Mutual labels:  async, multithreading
Lightio
LightIO is a userland implemented green thread library for ruby
Stars: ✭ 165 (-7.3%)
Mutual labels:  async, multithreading
Futures Intrusive
Synchronization primitives for Futures and async/await based on intrusive collections
Stars: ✭ 137 (-23.03%)
Mutual labels:  async, multithreading
Thenextquant
Asynchronous driven quantitative trading framework.
Stars: ✭ 172 (-3.37%)
Mutual labels:  async
React Use Wizard
🧙 A React wizard (stepper) builder without the hassle, powered by hooks.
Stars: ✭ 162 (-8.99%)
Mutual labels:  async
Microjob
A tiny wrapper for turning Node.js worker threads into easy-to-use routines for heavy CPU loads.
Stars: ✭ 1,985 (+1015.17%)
Mutual labels:  multithreading
Bfj
MOVED TO GITLAB
Stars: ✭ 164 (-7.87%)
Mutual labels:  async
Ocaml Caqti
Cooperative-threaded access to relational data
Stars: ✭ 175 (-1.69%)
Mutual labels:  async
React Serial Forms
A lightweight and extendable SSR-friendly form library (for React).
Stars: ✭ 172 (-3.37%)
Mutual labels:  async
Riptide
Client-side response routing for Spring
Stars: ✭ 169 (-5.06%)
Mutual labels:  async
Message Bus
Go simple async message bus
Stars: ✭ 166 (-6.74%)
Mutual labels:  async
Pulsar4s
Idiomatic, typesafe, and reactive Scala client for Apache Pulsar
Stars: ✭ 172 (-3.37%)
Mutual labels:  async
Await To Js
Async await wrapper for easy error handling without try-catch
Stars: ✭ 2,223 (+1148.88%)
Mutual labels:  async
Java Concurrency Examples
Java Concurrency/Multithreading Tutorial with Examples for Dummies
Stars: ✭ 173 (-2.81%)
Mutual labels:  multithreading
Redux Promise Middleware
Enables simple, yet robust handling of async action creators in Redux
Stars: ✭ 2,001 (+1024.16%)
Mutual labels:  async
Smol
A small and fast async runtime for Rust
Stars: ✭ 2,206 (+1139.33%)
Mutual labels:  async
Hitchcock
The Master of Suspense 🍿
Stars: ✭ 167 (-6.18%)
Mutual labels:  async
Gol
gol is a high performance async log kit for golang
Stars: ✭ 166 (-6.74%)
Mutual labels:  async
Sobjectizer
An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.
Stars: ✭ 172 (-3.37%)
Mutual labels:  multithreading
Dispatch ## Build Status
Branch Status
master Bunch Status
develop Bunch Status

Dispatch

Swift 3.0 Platforms License

Carthage compatible Podspec

codebeat badge codecov

Note:

Dispatch requires swift 3.0. Use version 1.0.0 for swift 2.3 or version 0.9.8 for swift 2.2.

Installation

CocoaPods

Dispatch is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Dispatch'

Carthage


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Dispatch into your Xcode project using Carthage, specify it in your Cartfile:

github "Swiftification/Dispatch"

Run carthage update to fetch the Dispatch library and drag into your Xcode project.

And then simply

import DispatchFramework

And your good to go!

Manually

  1. Download and drop Dispatch.swift anywhere you like in your project.
  2. That's it.

Usage

Basic

Dispatch.async(dispatch_get_main_queue()) {
  //Code to be run on the main thread
}
Or using the helpers provided by Dispatch.Queue enum
Dispatch.async(Queue.main) {
  //Code to be run on the main thread
}
Or using the overloaded method to run on the main thread
Dispatch.async {
  //Code to be run on the main thread
}

Types of Dispatch

Async

Dispatch.async(Queue.main) {
  //Code to be run on the main thread
}

Sync

let someCustomQueue = dispatch_queue_create("custom.queue.dispatch", DISPATCH_QUEUE_CONCURRENT)
Dispatch.sync(someCustomQueue) {
  //Code to be synchronously on someCustomQueue
}

After

Dispatch.after(1.0, queue: Queue.main) {
  //Code to be run on the main thread after 1 second
}
Or using the overloaded method to run on the main thread
Dispatch.after(1.0) {
  //Code to be run on the main thread after 1 second
}

Once

let token : dispatch_once_t
Dispatch.once(&token) {
  //Code to be run only once in App lifetime
}

Queue Helpers

Main queue

let mainQueue = Queue.main 

Custom queue

let customConcurrentQueue = Queue.custom("custom.concurrent.queue.dispatch", Queue.Atribute.concurrent)
let customSerialQueue = Queue.custom("custom.serial.queue.dispatch", Queue.Atribute.serial)

Global queues

let priority = 0 // or you use one of the Global priorities (ex: Queue.Priority.UserInteractive)
let globalQueue = Queue.global(priority)

// For comodity there are helpers for getting the Global queues

let globalUserInteractiveQueue = Queue.globalUserInteractive
let globalUserInitiatedQueue = Queue.globalUserInitiated
let globalUtilityQueue = Queue.globalUtility
let globalBackgroundQueue = Queue.globalBackground

TODO

  • [X] Carthage compatible
  • [X] Chainable methods
  • [X] Travis CI
  • [X] Unit Tests
  • [ ] More examples

Communication

  • If you find a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Authors

License

Dispatch is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].