Queues, timers, and task groups in Swift

Overview

Dispatcher eases the pain of using Grand Central Dispatch by introducing 4 new Swift classes.

Thank me!

Requirements

  • Swift 2.0+

Installation

CocoaPods

Dispatcher is not yet available on CocoaPods.

Carthage
github "aleclarson/dispatcher" "master"
Manually

Drag-and-drop the Dispatcher.xcodeproj into your own Xcode project. In your application target's Build Phases, add Dispatcher.framework to Target Dependencies, Link Binary With Libraries, and Copy Files.

If that gives you trouble, open the Dispatcher.xcodeproj in Xcode and build the framework target. Right-click Dispatcher.framework in the Products folder in your Project Navigator and click Show in Finder. Drag-and-drop the Dispatcher.framework from your finder into your Xcode project.

You might also like...
Make your logic flow and data flow clean and human readable

Flow What's Flow Flow is an utility/ design pattern that help developers to write simple and readable code. There are two main concerns: Flow of opera

Extensions and additions to AsyncSequence, AsyncStream and AsyncThrowingStream.

Asynchone Extensions and additions to AsyncSequence, AsyncStream and AsyncThrowingStream. Requirements iOS 15.0+ macOS 12.0+ Installation Swift Packag

straightforward networking and error handling with async-await and URLSession

AsyncAwaitNetworkingPlayground How To Run Just clone the project, open it and run. Some notes about AsyncAwaitNetworkingPlayground It's a straightforw

A complete set of primitives for concurrency and reactive programming on Swift
A complete set of primitives for concurrency and reactive programming on Swift

A complete set of primitives for concurrency and reactive programming on Swift 1.4.0 is the latest and greatest, but only for Swift 4.2 and 5.0 use 1.

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way
GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way. This help

SwiftCoroutine - Swift coroutines for iOS, macOS and Linux.
SwiftCoroutine - Swift coroutines for iOS, macOS and Linux.

Many languages, such as Kotlin, Go, JavaScript, Python, Rust, C#, C++ and others, already have coroutines support that makes the async/await pattern i

Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch (iOS7+ and OS X 10.9+ compatible)

Async.legacy Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch (GCD) Async rewritten for iOS7 and OS X 10.9 Compatibility

A Swift DSL that allows concise and effective concurrency manipulation
A Swift DSL that allows concise and effective concurrency manipulation

NOTE Brisk is being mothballed due to general incompatibilities with modern version of Swift. I recommend checking out ReactiveSwift, which solves man

A lightweight swift network layer with Combine, Async-Await, and a traditional completion block.

CombineNetwork A simple light-weight network library to make network requesting simpler. It supports newer techonology such as async/await as well as

Comments
  • Updates for Swift 1.2

    Updates for Swift 1.2

    I ran Xcode migration tool. After that, I had to apply some manual changes:

    • I removed the assigned value to the isConcurrent DispatchQueue constant. It was confusing for me to see it re-assigned in the initializers
    • I also assigned the gcd.serial() value to the queue constant inline with its declaration in DispatchTimer
    • I had to remove the sync and async implementations that accept an @autoclosure callback in the DispatchQueue class because of how autoclosure works now in Swift 1.2 (in particular, @autoclosure implies @noescape, that certainly doesn't work for the async method, but seems to not work for the sync either, due to some issues with the dispatch_sync (that obviously doesn't mark its parameter with @noescape or @autoclosure).
    • Of course I had to update the tests code to explicitly use a closure where @autoclosure was used before.

    Let me know if you need something else

    16 tests are passing.

    opened by vittoriom 3
  • Swift 2.0 migration, 16 tests passing

    Swift 2.0 migration, 16 tests passing

    Migrated the codebase to make it compatible with Xcode 7, Swift 2.0

    The only breaking change is the repeat function that now has to become doRepeat since repeat is a keyword in Swift 2.0

    opened by vittoriom 1
  • Start versioning

    Start versioning

    Now that Xcode 7 and Swift 2.0 is out of beta it would be nice to start versioning your library. Like other libraries you should use the github releases to make it easy following changes by version.

    opened by MattesGroeger 0
  • Fix Carthage warnings

    Fix Carthage warnings

    You can build the library with carthage but it spits out a number of warnings:

    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
    ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/DispatchTimer.swift:42:25: warning: extraneous '_' in parameter: 'times' has no keyword argument name
    ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/Developer/Library/Frameworks'
    ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/Developer/Library/Frameworks'
    warning: skipping copy phase strip, binary is code signed: /Users/me/Documents/workspaces/idagio/idagio-ios/Carthage/Checkouts/dispatcher/Build/Products/Release-iphoneos/Dispatcher.framework/Dispatcher
    
    opened by MattesGroeger 0
Owner
Alec Larson
Vite maintainer, React Spring co-author, Immer co-author, React Native aficionado, TypeScript/Nim enthusiast
Alec Larson
⚡️ Fast async task based Swift framework with focus on type safety, concurrency and multi threading

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 appl

Said Sikira 814 Oct 30, 2022
Several synchronization primitives and task synchronization mechanisms introduced to aid in modern swift concurrency.

AsyncObjects Several synchronization primitives and task synchronization mechanisms introduced to aid in modern swift concurrency. Overview While Swif

SwiftyLab 20 Jan 3, 2023
Kommander is a Swift library to manage the task execution in different threads.

A lightweight, pure-Swift library for manage the task execution in different threads. Through the definition a simple but powerful concept, Kommand.

Intelygenz 173 Apr 11, 2022
Schedule timing task in Swift using a fluent API. (A friendly alternative to Timer)

Schedule(简体中文) Schedule is a timing tasks scheduler written in Swift. It allows you run timing tasks with elegant and intuitive syntax. Features Elega

Luo Xiu 1.8k Jan 7, 2023
A Task Queue Class developed in Swift (by Marin Todorov)

TaskQueue Table of Contents Intro Installation CocoaPods Carthage Simple Examples Synchronous tasks Asynchronous tasks Serial and Concurrent Tasks GCD

Marin Todorov 677 Jan 3, 2023
AsyncTaskKit - contains some additions to async/await Task

AsyncTaskKit This repo contains some additions to async/await Task. In general i

Michał Zaborowski 0 Jan 2, 2022
Venice - Coroutines, structured concurrency and CSP for Swift on macOS and Linux.

Venice provides structured concurrency and CSP for Swift. Features Coroutines Coroutine cancelation Coroutine groups Channels Receive-only chan

Zewo 1.5k Dec 22, 2022
Async and concurrent versions of Swift’s forEach, map, flatMap, and compactMap APIs.

CollectionConcurrencyKit Welcome to CollectionConcurrencyKit, a lightweight Swift package that adds asynchronous and concurrent versions of the standa

John Sundell 684 Jan 9, 2023
Slack message generator and API client, written in Swift with Result Builders and Concurrency

Slack Message Client This package provides a Swift object model for a Slack Block Kit message, as well as a Result Builder convenience interface for e

Mike Lewis 2 Jul 30, 2022
Automatically generate GraphQL queries and decode results into Swift objects, and also interact with arbitrary GitHub API endpoints

GitHub API and GraphQL Client This package provides a generic GitHub API client (GithubApiClient) as well as Codable-like GitHub GraphQL querying and

Mike Lewis 4 Aug 6, 2022