Job Scheduler for IOS with Concurrent run, failure/retry, persistence, repeat, delay and more

Overview

SwiftQueue

Schedule tasks with constraints made easy.

Awesome platform swift Swift codecov pod Carthage compatible Swift Package Manager compatible Documentation

SwiftQueue is a job scheduler for iOS inspired by popular android libraries like android-priority-jobqueue or android-job. It allows you to run your tasks with run and retry constraints.

Library will rely on Operation and OperationQueue to make sure all tasks will run in order. Don't forget to check our WIKI.

Features

  • Sequential or Concurrent execution
  • Persistence
  • Cancel all, by id or by tag
  • Start / Stop queue

Job Constraints:

  • Delay
  • Deadline
  • Timeout
  • Internet
  • Charging
  • Single instance in queue
  • Retry: Max count, exponential backoff
  • Periodic: Max run, interval delay
  • Experimental Foreground or Background execution

Requirements

  • iOS 8.0+, watchOS 2.0+, macOS 10.10+, tvOS 9.0+
  • Xcode 11.0

Installation

SwiftPackageManager (SPM)

To integrate using Apple's Swift package manager, add the following as a dependency to your Package.swift:

.package(url: "https://github.com/lucas34/SwiftQueue.git", .upToNextMajor(from: "4.0.0"))

Carthage

SwiftQueue is carthage compatible. Add the following entry in your Cartfile:

github "lucas34/SwiftQueue"

Then run carthage update.

CocoaPods

You can use CocoaPods to install SwiftQueue by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'SwiftQueue'

In your application, simply import the library

import SwiftQueue

Example

This example will simply wrap an api call. Create your custom job by extending Job with onRun, onRetry and onRemove callbacks.

// A job to send a tweet
class SendTweetJob: Job {
    
    // Type to know which Job to return in job creator
    static let type = "SendTweetJob"
    // Param
    private let tweet: [String: Any]

    required init(params: [String: Any]) {
        // Receive params from JobBuilder.with()
        self.tweet = params
    }

    func onRun(callback: JobResult) {
        let api = Api()
        api.sendTweet(data: tweet).execute(onSuccess: {
            callback.done(.success)
        }, onError: { error in
            callback.done(.fail(error))
        })
    }

    func onRetry(error: Error) -> RetryConstraint {
        // Check if error is non fatal
        return error is ApiError ? RetryConstraint.cancel : RetryConstraint.retry(delay: 0) // immediate retry
    }

    func onRemove(result: JobCompletion) {
        // This job will never run anymore  
        switch result {
            case .success:
                // Job success
            break
            
            case .fail(let error):
                // Job fail
            break
       
        }
    }
}

Create your SwiftQueueManager and keep the reference. If you want to cancel a job it has to be done with the same instance.

let manager = SwiftQueueManagerBuilder(creator: TweetJobCreator()).build()

Schedule your job and specify the constraints.

JobBuilder(type: SendTweetJob.type)
        // Requires internet to run
        .internet(atLeast: .cellular)
        // params of my job
        .with(params: ["content": "Hello world"])
        // Add to queue manager
        .schedule(manager: manager)

Bind your job type with an actual instance.

class TweetJobCreator: JobCreator {

    // Base on type, return the actual job implementation
    func create(type: String, params: [String: Any]?) -> Job {
        // check for job and params type
        if type == SendTweetJob.type  {
            return SendTweetJob(params: params)
        } else {
            // Nothing match
            // You can use `fatalError` or create an empty job to report this issue.
            fatalError("No Job !")
        }
    }
}

3rd Party Extensions

Contributors

We would love you for the contribution to SwiftQueue, check the LICENSE file for more info.

License

Distributed under the MIT license. See LICENSE for more information.

Comments
  • Facing issue in syncronisation

    Facing issue in syncronisation

    Hi, I am using JobCreator with custom params as below let swiftQueueManager = SwiftQueueManagerBuilder(creator: JobCreator(otherParams : otherParams, completion:completionForJob)).build()

    First thing is I run this line of code every time i.e. this instance is created every time as the params values is different always and there is no way to set JobCreator in ManagerBuilder other than initialisation. After 3-4 such runs, the jobs get executed but not in synchronised manner.

    Do I need to keep the instance of manager on class level? If yes, then how can I set job creator in the manager as it has different params every time.

    And how is job removed after successful run? Do I manually need to call remove function after execution in onRun() method?

    Please respond. Thanks

    question 
    opened by Dhillon22 14
  • Get additional info for a job

    Get additional info for a job

    Is it possible to get additional information about a running task: scheduled start time, number of iterations, task status (pending, running, completed)? If it were possible to obtain an instance of SqOperation publicly, then this question would not exist.

    wontfix 
    opened by ivan-kolesov 10
  • Persisted jobs are not removed anymore in v5.0.1

    Persisted jobs are not removed anymore in v5.0.1

    Hi @lucas34,

    I have just tested v5.0.1 and I'm sorry but relative bug is still present... Persisted jobs are not removed from "persistence" if app has been killed before. There are still restored again and again... πŸ˜•

    App launch logs with SwiftQueue v5.0.1: 1 print of insert in queue, 1 print of restore in queue for persisted jobs and only one print of remove from queue for StopRideJob which is the only one not persisted. Persisted jobs are restored, still not inserted and not removed

    16:03:59.344 πŸ’œ VERBOSE LRJobPersister.init():17 - create a LR job persister v5 16:03:59.344 πŸ’œ VERBOSE LRJobPersister.restore():26 - restore 16:03:59.345 πŸ’œ VERBOSE LRJobPersister.restore():34 - restore in queue 16:03:59.347 πŸ’š DEBUG AutoRenameRideJob.init():64 - create a job to auto rename ride 3 16:03:59.350 πŸ’š DEBUG StartRideJob.init():103 - create a job to start ride 3 16:03:59.350 πŸ’š DEBUG PauseRideJob.init():65 - create a job to pause ride 3 16:03:59.351 πŸ’š DEBUG ResumeRideJob.init():66 - create a job to resume ride 3 16:03:59.352 πŸ’š DEBUG StartRideJob.onRun():110 - run the job to start ride 3 16:04:00.204 πŸ’š DEBUG StopRideJob.init():88 - create a job to stop ride 3 16:04:00.204 πŸ’œ VERBOSE LRJobPersister.put():42 - insert in queue 16:04:00.562 πŸ’š DEBUG StartRideJob.onRemove():144 - remove the job to start ride 3 16:04:00.563 πŸ’™ INFO StartRideJob.onRemove():150 - ride 3 has been started 16:04:00.563 πŸ’š DEBUG PauseRideJob.onRun():72 - run a job to pause ride 3 16:04:01.197 πŸ’š DEBUG PauseRideJob.onRemove():108 - remove a job to pause ride 3 16:04:01.198 πŸ’™ INFO PauseRideJob.onRemove():114 - ride 3 is paused 16:04:01.198 πŸ’š DEBUG ResumeRideJob.onRun():73 - run a job to resume ride 3 16:04:01.715 πŸ’š DEBUG ResumeRideJob.onRemove():109 - remove a job to resume ride 3 16:04:01.715 πŸ’™ INFO ResumeRideJob.onRemove():115 - ride 3 is resumed 16:04:01.716 πŸ’š DEBUG AutoRenameRideJob.onRun():72 - run a job to auto rename ride 3 16:04:02.104 πŸ’š DEBUG AutoRenameRideJob.onRemove():119 - remove the job to auto rename ride 3 16:04:02.105 πŸ’™ INFO AutoRenameRideJob.onRemove():125 - ride 3 has been auto renamed 16:04:02.105 πŸ’š DEBUG StopRideJob.onRun():96 - run the job to stop ride 3 16:04:02.248 πŸ’œ VERBOSE LRJobPersister.remove():54 - remove from queue 16:04:02.249 πŸ’š DEBUG StopRideJob.onRemove():130 - remove the job to stop ride 3 16:04:02.250 πŸ’™ INFO StopRideJob.onRemove():136 - ride 3 has been stopped

    Originally posted by @Narayane in https://github.com/lucas34/SwiftQueue/issues/362#issuecomment-739980214

    opened by Narayane 8
  • Persisted jobs are not removed anymore in v5.0

    Persisted jobs are not removed anymore in v5.0

    Hi,

    I notice a bug between v4.3 and v5.0. My persisted jobs are not removed anymore from UserDefaults. I have a JobPersister custom implementation which is the same than your UserDefaultsPersister but with logs.

    I have 3 test cases to validate my jobs work:

    1. full online // nominal case
    2. offline then online without app kill // test connectivity return
    3. offline, app kill, online, app launch, run the persisted jobs, app kill, app relaunch // test persistence

    With v5.0, 1. and 2. are ok but 3. fails. I used the same process in both cases below.

    App launch logs with SwiftQueue v4.3: "witness" logs

    16:59:29.180 πŸ’œ VERBOSE LRJobPersister.init():19 - create a LR job persister 16:59:29.183 πŸ’œ VERBOSE LRJobPersister.restore():26 - restore 16:59:29.183 πŸ’œ VERBOSE LRJobPersister.restore():34 - restore in queue 16:59:29.183 πŸ’š DEBUG AutoRenameRideJob.init():64 - create a job to auto rename ride 2 16:59:29.184 πŸ’š DEBUG ResumeRideJob.init():66 - create a job to resume ride 2 16:59:29.185 πŸ’š DEBUG PauseRideJob.init():65 - create a job to pause ride 2 16:59:29.186 πŸ’š DEBUG StartRideJob.init():103 - create a job to start ride 2 16:59:29.187 πŸ’œ VERBOSE LRJobPersister.put():42 - insert in queue 16:59:29.189 πŸ’œ VERBOSE LRJobPersister.put():42 - insert in queue 16:59:29.189 πŸ’š DEBUG StartRideJob.onRun():110 - run the job to start ride 2 16:59:29.189 πŸ’œ VERBOSE LRJobPersister.put():42 - insert in queue 16:59:29.190 πŸ’œ VERBOSE LRJobPersister.put():42 - insert in queue 16:59:29.670 πŸ’š DEBUG StopRideJob.init():88 - create a job to stop ride 2 16:59:29.671 πŸ’œ VERBOSE LRJobPersister.put():42 - insert in queue 16:59:30.408 πŸ’œ VERBOSE LRJobPersister.remove():54 - remove from queue 16:59:30.408 πŸ’š DEBUG PauseRideJob.onRun():72 - run a job to pause ride 2 16:59:30.410 πŸ’š DEBUG StartRideJob.onRemove():144 - remove the job to start ride 2 16:59:30.410 πŸ’™ INFO StartRideJob.onRemove():150 - ride 2 has been started 16:59:30.518 πŸ’œ VERBOSE LRJobPersister.remove():54 - remove from queue 16:59:30.518 πŸ’š DEBUG ResumeRideJob.onRun():73 - run a job to resume ride 2 16:59:30.520 πŸ’š DEBUG PauseRideJob.onRemove():108 - remove a job to pause ride 2 16:59:30.520 πŸ’™ INFO PauseRideJob.onRemove():114 - ride 2 is paused 16:59:30.821 πŸ’œ VERBOSE LRJobPersister.remove():54 - remove from queue 16:59:30.822 πŸ’š DEBUG AutoRenameRideJob.onRun():72 - run a job to auto rename ride 2 16:59:30.823 πŸ’š DEBUG ResumeRideJob.onRemove():109 - remove a job to resume ride 2 16:59:30.823 πŸ’™ INFO ResumeRideJob.onRemove():115 - ride 2 is resumed 16:59:31.215 πŸ’œ VERBOSE LRJobPersister.remove():54 - remove from queue 16:59:31.215 πŸ’š DEBUG StopRideJob.onRun():96 - run the job to stop ride 2 16:59:31.218 πŸ’š DEBUG AutoRenameRideJob.onRemove():119 - remove the job to auto rename ride 2 16:59:31.219 πŸ’™ INFO AutoRenameRideJob.onRemove():125 - ride 2 has been auto renamed 16:59:31.414 πŸ’œ VERBOSE LRJobPersister.remove():54 - remove from queue 16:59:31.416 πŸ’š DEBUG StopRideJob.onRemove():130 - remove the job to stop ride 2 16:59:31.416 πŸ’™ INFO StopRideJob.onRemove():136 - ride 2 has been stopped

    App launch logs with SwiftQueue v5.0: No prints of insert in queue, 4 prints of restore in queue for persisted jobs and only one print of remove from queue for StopRideJob which is the only one not persisted. Persisted jobs are restored, curiously not inserted and not removed

    16:24:13.940 πŸ’œ VERBOSE LRJobPersister.init():17 - create a LR job persister v5 16:24:13.940 πŸ’œ VERBOSE LRJobPersister.restore():26 - restore 16:24:13.940 πŸ’œ VERBOSE LRJobPersister.restore():34 - restore in queue 16:24:13.940 πŸ’œ VERBOSE LRJobPersister.restore():34 - restore in queue 16:24:13.941 πŸ’œ VERBOSE LRJobPersister.restore():34 - restore in queue 16:24:13.942 πŸ’š DEBUG AutoRenameRideJob.init():64 - create a job to auto rename ride 1 16:24:13.944 πŸ’š DEBUG ResumeRideJob.init():66 - create a job to resume ride 1 16:24:13.946 πŸ’š DEBUG StartRideJob.init():103 - create a job to start ride 1 16:24:13.947 πŸ’š DEBUG PauseRideJob.init():65 - create a job to pause ride 1 16:24:13.947 πŸ’œ VERBOSE LRJobPersister.restore():34 - restore in queue 16:24:13.950 πŸ’š DEBUG StartRideJob.onRun():110 - run the job to start ride 1 16:24:15.139 πŸ’š DEBUG StartRideJob.onRemove():144 - remove the job to start ride 1 16:24:15.140 πŸ’™ INFO StartRideJob.onRemove():150 - ride 1 has been started 16:24:15.140 πŸ’š DEBUG PauseRideJob.onRun():72 - run a job to pause ride 1 16:24:15.469 πŸ’š DEBUG PauseRideJob.onRemove():108 - remove a job to pause ride 1 16:24:15.471 πŸ’™ INFO PauseRideJob.onRemove():114 - ride 1 is paused 16:24:15.477 πŸ’š DEBUG ResumeRideJob.onRun():73 - run a job to resume ride 1 16:24:15.645 πŸ’š DEBUG AutoRenameRideJob.onRun():72 - run a job to auto rename ride 1 16:24:15.645 πŸ’š DEBUG ResumeRideJob.onRemove():109 - remove a job to resume ride 1 16:24:15.645 πŸ’™ INFO ResumeRideJob.onRemove():115 - ride 1 is resumed 16:24:15.983 πŸ’š DEBUG AutoRenameRideJob.onRemove():119 - remove the job to auto rename ride 1 16:24:15.985 πŸ’™ INFO AutoRenameRideJob.onRemove():125 - ride 1 has been auto renamed 16:24:14.774 πŸ’š DEBUG StopRideJob.init():88 - create a job to stop ride 1 16:24:14.774 πŸ’œ VERBOSE LRJobPersister.put():42 - insert in queue 16:24:15.983 πŸ’š DEBUG AutoRenameRideJob.onRemove():119 - remove the job to auto rename ride 1 16:24:15.985 πŸ’™ INFO AutoRenameRideJob.onRemove():125 - ride 1 has been auto renamed 16:24:15.986 πŸ’š DEBUG StopRideJob.onRun():96 - run the job to stop ride 1 16:24:16.150 πŸ’œ VERBOSE LRJobPersister.remove():54 - remove from queue 16:24:16.151 πŸ’š DEBUG StopRideJob.onRemove():130 - remove the job to stop ride 1 16:24:16.153 πŸ’™ INFO StopRideJob.onRemove():136 - ride 1 has been stopped

    bug PR Welcome P0 
    opened by Narayane 7
  • Understanding how to run SwiftQueue jobs in the background

    Understanding how to run SwiftQueue jobs in the background

    It appears that SwiftQueue has support for the BackgroundTask framework, but doesn't include much documentation as to how it should be used.

    Here's what I've figured out so far – could you help fill in the rest?

    1. In application:didFinishLaunching, I register a task identifier:
    let taskIdentifier = "com.myapp.uploadJobTask"
    queueManager.registerForBackgroundTask(forTaskWithUUID: taskIdentifier)
    
    1. I included "com.myapp.uploadJobTask" in my Info.plist under BGTaskSchedulerPermittedIdentifiers.

    2. Use the following JobBuilder (note that .parallel is used to name the queue the same as the task identifier:

    JobBuilder(type: UploadPhotoJob.type)
        // One job per upload
        .singleInstance(forId: String(photo.id))
       
        // Name the queue so SwiftQueue create a background task
        .parallel(queueName: "com.myapp.uploadJobTask")
    
        .with(params: [
            ...
        ]).retry(limit: .limited(5))
        
        .persist(required: true)
        
        .schedule(manager: queueManager)
    

    Here's where I'm not sure:

    1. When the app goes into the background, call:
    queueManager.applicationDidEnterBackground()
    

    However, this eventually calls getAllAllowBackgroundOperation(), which filters the jobs by their executor value (which defaults to .foreground).

    It looks like the only way of setting the job to .background or .any is to use .periodic, which doesn't make sense for an upload job.

    What is the correct way of specifying that the job can/should be executed in either foreground or background?

    Furthermore, are there any other steps required to support background task execution?

    Thank you!

    wontfix 
    opened by momentsdesigns 6
  • BackgroundTasks from iOS 13

    BackgroundTasks from iOS 13

    Is there any plans or ideas yet surrounding the BackgroundTasks API's release in iOS 13. I can see that allowing jobs to be scheduled to run when the app is backgrounded might be a very useful feature

    enhancement PR Welcome P1 
    opened by foxware00 6
  • Crash when enqueue from multiples thread

    Crash when enqueue from multiples thread

    Queues are managed by a dictionary in SwiftQueueManager, would there be data racing when multiple jobs scheduled from different threads at same time?

    opened by LiLiKazine 5
  • Type does not conform to protocol 'JobCreator'

    Type does not conform to protocol 'JobCreator'

    I am having trouble implementing this

        import SwiftQueue
    
        class BackgroundJobCreator: JobCreator {
        func create(type: String, params: [String: Any]?) -> Job? {
            // params as specified in JobBuilder.with()
            if type == BackgroundUploadService.type {
                // Return our actual job.
                return BackgroundUploadService(params: params!)
            } else {
                // Nothing match
                return nil
            }
        }
    

    The alert that comes up is:

    Type 'BackgroundJobCreator' does not conform to protocol 'JobCreator'

    I can add protocol subs but it generates this which doesn't solve anything.. func create(type: String, params: [String : Any]?) -> Job { <#code#> }

    Additionally which might be unrelated is this pop ups in my job class

    required' initializer 'init(from:)' must be provided by subclass of 'Job'

    which demands

    required convenience init(from decoder: Decoder) throws {
            fatalError("init(from:) has not been implemented")
        }
    

    I haven't seen this code in any examples.

    opened by towcar 5
  • Added capability to pass params when success and multiple listeners

    Added capability to pass params when success and multiple listeners

    Hi,

    In my case I needed to receive data on JobListener, so to resolve that I put a parameter on success, and I did other thing about listener, for organization I change JobListener to array because now I can put multiple Listeners doing specific things.

    Look if it make sense for you.

    Best, Victor C Tavernari

    opened by Tavernari 5
  • Missing CFBundleVersion?

    Missing CFBundleVersion?

    I'm attempting to build a production version of an app which has SwiftQueue as a dependency. When I do so and attempt to validate it with iTunes Connect I receive an error that...

    SwiftQueue framework is invalid. The Info.plist file is missing the required key: CFBundleVersion

    In the SwiftQueue.xcodeproj/SwiftQueue_Info.plist file CFBundleVersion is mapped to a build variable called CURRENT_PROJECT_VERSION. In the build settings it looks like CURRENT_PROJECT_VERSION isn't actually set to anything which I assume isn't deliberate.

    Am I misunderstanding or does that need to be added to the source?

    question PR Welcome 
    opened by mylesbarros 5
  • Replace Reachability dependency with NWPathMonitor usage

    Replace Reachability dependency with NWPathMonitor usage

    Hi, I've been looking into integrating this library into my project, with the purpose of using it across iOS and watchOS. Xcode won't build the watchOS target due to the Reachability dependency, which uses SystemConfiguration as stated in #379 (no matter if I use anything related to reachability or not, just including it in my watchOS target fails to compile)

    Screen Shot 2022-06-21 at 08 41 23

    Would you be interested in a PR replacing the use of Reachability for NWPathMonitor from the Network framework which is available on all platforms (although the targets are higher: iOS 12+, macOS 10.14+, watchOS 5.0+, etc)?

    I saw one article from Hacking with Swift and the usage looks pretty straight forward, and it also makes available the isExpensive flag for connections

    PR Welcome 
    opened by GianniCarlo 4
  • Last persisted job appears to run twice (before and after app restart)

    Last persisted job appears to run twice (before and after app restart)

    πŸ‘‹

    I'm having a problem with duplicate job runs after app startup when the job is persisted:

    Repro: https://gist.github.com/ruslandoga/425765b892605c426f55b7c02683bace

    Version: SwiftQueue (5.0.2)

    Expected output:

    job created Optional(["id": 4])
    job runs Optional(["id": 4])
    job removed Optional(["id": 4])
    // -- app stops and then starts again --
    job created Optional(["id": 5])
    job runs Optional(["id": 5])
    job removed Optional(["id": 5])
    

    Actual output:

    job created Optional(["id": "4"])
    job runs Optional(["id": "4"])
    job created Optional(["id": 4])
    job created Optional(["id": "5"])
    job runs Optional(["id": 4])
    job runs Optional(["id": "5"])
    job removed Optional(["id": 4])
    job removed Optional(["id": "5"])
    
    PR Welcome 
    opened by ruslandoga 1
Releases(6.0.2)
  • 6.0.2(Nov 27, 2022)

  • 6.0.1(Sep 30, 2022)

    Improvement

    • Allow instantiation and override of DefaultConstraintMaker to deserialize constraints (#414) (#416)

    Chore

    • Update Swift to 5.7.0 (#419)
    • Update Xcode Version in Github Actions (#420)
    • Update Actions dependencies (#421)
    • Update Bundle (#418)
    • Lint correct (#417)
    Source code(tar.gz)
    Source code(zip)
  • 6.0.0(Jun 29, 2022)

    Breaking Changes

    Replace Reachability framework with NWPathMonitor (#406)

    Minimum version required has been updated

    platforms: [
        .macOS(.v10_14),
        .iOS(.v12),
        .macCatalyst(.v13),
        .tvOS(.v12),
        .watchOS(.v5),
    ]
    
    • Dependency over Reachability has been removed and replaced with NWPathMonitor
    • WatchOS can now use NetworkConstraint

    Thanks, @GianniCarlo for the contribution πŸŽ‰

    Core

    • Remove empty files (#408)
    • Update copyright (#410)
    • Add test for network listener (#411)
    Source code(tar.gz)
    Source code(zip)
  • 5.1.0(May 5, 2022)

    Bug fix

    Allow user to specify enqueue DispatchQueue to fix multi-thread enqueue crash (#403)

    SwiftQueueManagerBuilder(creator: creator)
            .set(enqueueDispatcher: .main)
    

    Breaking Changes

    • JobListener now has onJobScheduled callback (#384)

    New features

    • Add Lambda Job (#382)

    For simple job, instead of creating your own implementation of Job, you can use LambdaJob {}

    Chore

    • Update Swift (#397)
    Source code(tar.gz)
    Source code(zip)
  • 5.0.2(Dec 20, 2020)

  • 5.0.1(Dec 5, 2020)

  • 5.0.0(Oct 18, 2020)

    Warning: This version is incompatible with 4.X

    If you are using serialised task. After updating, the library will not be able to deserialised the task saved with version 4.X

    New features

    You can now add your own constraint dynamically

    • Dynamic constraint feature (#310)
    • Add custom constraint (#343)

    Breaking Changes

    • Rename NoSerialiser to NoPersister (#341)

    Chore

    • Bump Reachability (#354)

    Internal changes

    • Cleanup (#342) (#347) (#353) (#356) (#357)
    • Dynamic constraint feature (#310)
    Source code(tar.gz)
    Source code(zip)
    SwiftQueue.zip(13.00 MB)
  • 4.3.0(Jun 9, 2020)

    Breaking Changes

    • JobBuilder method requireCharging(value: Bool) was renamed .requireCharging() (#311)
    • JobBuilder method .persist(required: true) was renamed .persist() (#312)
    • JobBuilder method .internet(atLeast: .any) is forbidden. It's already default behaviour (#329)
    • Internet constraint cannot be used if Operation is running in main thread (#329)
    • Logger jobId parameter function can be nil (#318)
    • Remove V1 serialiser (#320)
    • Remove JobCount() method that is relying on a deprecated method (#337) (#336)

    New features

    • Add JobBuilder.copy() (#304)

    Chore

    • Update to Swift 5.2 (#306)

    Internal changes

    • Cleanup (#302) (#313) (#319) (#321) (#322) (#327) (#330)
    • Constrains refactoring (#326) (#328) (#331) (#332) (#333) (#335)

    Build

    • Auto archive carthage build artifacts (#303) (#308)
    • Update dependencies (#301) (#307)
    Source code(tar.gz)
    Source code(zip)
    SwiftQueue.framework.zip(12.51 MB)
  • 4.2.0(May 8, 2020)

    New features

    Make backgroundTask available for MacOS 10.15 (#299)

    Chore

    Update to Swift 5.1 (#280)

    Internal changes

    Refactor constraints (#282) Refactor encoding (#283)

    Source code(tar.gz)
    Source code(zip)
  • 4.1.0(Nov 4, 2019)

  • 4.0.1(Oct 12, 2019)

  • 4.0.0(Sep 21, 2019)

  • 3.2.0(Jun 9, 2019)

  • 3.1.0(May 13, 2019)

    New features

    • Job status listener (#217)
    • Allow a queue to run multiple jobs in parallel (#215)

    Breaking changes

    • Rename synchronous to initInBackground (#213)
    • Rename group() to parallel() (#212)

    Enhancement

    • Better control on running for duplicate job constraint (#219)
    • Add no logger by default (#211)
    Source code(tar.gz)
    Source code(zip)
    SwiftQueue.framework.zip(6.59 MB)
  • 3.0.0(Apr 4, 2019)

  • 2.4.0(Jan 20, 2019)

  • 2.3.0(Sep 21, 2018)

  • 2.2.0(Aug 31, 2018)

  • 2.1.0(Jun 12, 2018)

  • 2.0.0(May 13, 2018)

    Breaking Changes

    • SwiftQueueManager need to be built with SwiftQueueManagerBuilder (#126)
    • Custom serializer and switch to codable by default (#115)
    • Minimum version required is Swift 3.2
    • Add a persister by default to avoid having persist(required: true) but no persister (#119)

    Improvement

    • Expose isSuspended from SwiftQueueManager (#145)
    • Revise JobInfo and make it conform to Codable protocol (#117) (#120)

    New features

    • Charging constraint (#123)
    • Deserialize tasks in background (#112)
    • Add internal logger (#105)

    Fix

    • Fix constraint does not properly cancel the job and execution flow should stop (#113)
    • Execution flow does not stop immediately after a constraint not satisfied (#113)
    • Parsing error not forwarded and not reported with the logger (#121)
    • Parsing error not reported and prevent the job to be serialized (#122)

    MISC

    • Update for Swift 3.3 and 4.1 (#110) (#111) (#107)
    • Add proper implementation of support compactMap (#116)
    Source code(tar.gz)
    Source code(zip)
    SwiftQueue.framework.zip(5.70 MB)
  • 1.6.1(Apr 17, 2018)

  • 1.6.0(Mar 21, 2018)

    Breaking Changes

    • Change JobCreator.create signature (#94)
      • Return type is no longer optional
      • SwiftQueueManager only accept 1 single JobCreator
      • This is to avoid unregistered handler or scheduling job with no JobCreator associates
      • The user will have to deal with unknown handler on his side
    • Origin error is now forward to completion block (#88)
    • Change signature of Limit(Int) to Limit(Double)

    Fix

    • Delay not waiting for the remaining time (#99)
    • Deadline now cancel the job properly (#98)
    • Fix calling done after termination will remove the lastError (#97)
    • Breaking support for Swift 3.2 (#75)

    Improvement

    • Avoid crash when scheduling a terminated job (#92)
    • Performance issue when overriding a job (#73)

    Misc

    • Update documentation
    Source code(tar.gz)
    Source code(zip)
    SwiftQueue.framework.zip(2.94 MB)
  • 1.5.0(Feb 1, 2018)

    Breaking Changes

    • Change Error type to follow enum pattern (#68)
      • TaskAlreadyExist -> SwiftQueueError.Duplicate
      • DeadlineError -> SwiftQueueError.Deadline
      • Canceled -> SwiftQueueError.Canceled

    Improvement

    • Performance improvement in for-loops

    Internal changes

    • SwiftQueue has been renamed SqOperationQueue
    • SwiftQueueJob -> SqOperation
    • JobBuilder has moved to its own class
    • SwiftQueue.swift reference all public protocols

    Misc

    • Support BUCK build

    Other changes

    • Remove unavailable methods (#71)
      • func retry(Int)
      • func periodic(Int, TimeInterval)
    Source code(tar.gz)
    Source code(zip)
    SwiftQueue.framework.zip(2.95 MB)
  • 1.4.1(Jan 22, 2018)

  • 1.4.0(Jan 12, 2018)

  • 1.3.2(Jan 9, 2018)

    New features

    • Allow overriding previous job for SingleInstance constraint (#38)
    • Add cancel with uuid (#42)

    Bug fix and improvements

    • Fix Swiftlint warnings (#36)
    • Fix readme documentation (#40)

    Misc

    Setup danger (#31) Support travis cache builds (#39)

    Source code(tar.gz)
    Source code(zip)
  • 1.3.1(Dec 22, 2017)

  • 1.3.0(Dec 15, 2017)

    Develop 1.3.0 (#22)

    Re-write 90% of the code.

    Breaking changes

    • Scheduling a job without a creator will throw an error (Assertion)
    • #20 Replace Any params type to [String: Any]
    • #26 Callback result now use enum to avoid passing nil error as success
    • #32 onRemove will foward JobCompletion
    • Remove delay(inSecond) use delay(time) instead

    Bug fix and improvements

    • #24 Improve documentation and publish
    • #25 Constraints should be public
    • Add assertion to validate the [String: Any] when serialise
    Source code(tar.gz)
    Source code(zip)
    SwiftQueue.framework.zip(2.94 MB)
  • 1.2.3(Nov 30, 2017)

  • 1.2.2(Nov 23, 2017)

Owner
Lucas Nelaupe
Only contribute to gluten-free libraries
Lucas Nelaupe
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
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

Quan Vo 42 Oct 5, 2022
A general purpose embedded hierarchical lock manager used to build highly concurrent applications of all types. Same type of locker used in many of the large and small DBMSs in existence today.

StickyLocking StickyLocking is a general purpose embedded lock manager which allows for locking any resource hierarchy. Installable Lock modes allow f

Sticky Tools 2 Jun 15, 2021
**`withCheckedContinuation`'s body will run on background thread in case of starting from main-actor.**

ConcurrencyContinuationReproduce Differences of Concurrency behaviors between Xcode 14.0 and 14.1 Xcode 14.0 iOS 13+: Runs on main (inherited same con

Hiroshi Kimura 4 Dec 20, 2022
🍴 Parallelize two or more async functions

Fork Parallelize two or more async functions What is Fork? Fork allows for a single input to create two separate async functions that return potential

Zach 4 Oct 15, 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
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

null 18 Jun 17, 2022
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

Red Davis 101 Jan 6, 2023
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

FΔ±rat YenidΓΌnya 17 Dec 11, 2022
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
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

Alex Belozierov 808 Dec 1, 2022
Tools for using Swift Concurrency on macOS 10.15 Catalina, iOS 13, tvOS 13, and watchOS 6.

ConcurrencyCompatibility Tools for using Swift Concurrency on macOS 10.15 Catalina, iOS 13, tvOS 13, and watchOS 6. Xcode 13.2 adds backwards deployme

Zachary Waldowski 9 Jan 3, 2023
iOS 13-compatible backports of commonly used async/await-based system APIs that are only available from iOS 15 by default.

AsyncCompatibilityKit Welcome to AsyncCompatibilityKit, a lightweight Swift package that adds iOS 13-compatible backports of commonly used async/await

John Sundell 367 Jan 5, 2023
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.

AsyncNinja 156 Aug 31, 2022
Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD).

Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD). It allows you to create any asynchronous and synchronous task easily, all managed by a queue, with just a few lines.

Fabrizio Brancati 1k Dec 2, 2022
SwiftyTimer allows you to instantly schedule delays and repeating timers using convenient closure syntax. It's time to get rid of Objective-C cruft.

SwiftyTimer Modern Swifty API for NSTimer SwiftyTimer allows you to instantly schedule delays and repeating timers using convenient closure syntax. It

Radek Pietruszewski 1.2k Dec 27, 2022
A demonstration for bridging between Combine and your new async functions

CombineAsyncually This is a DEMONSTRATION of how you can bridge the new async / await functionality in Swift 5.5 with Combine. There is NO WARRANTY. T

null 48 Dec 4, 2022
Queues, timers, and task groups in Swift

Dispatcher eases the pain of using Grand Central Dispatch by introducing 4 new Swift classes. Dispatcher Queue Group Timer Requirements Swift 2.0+ Ins

Alec Larson 109 Jan 29, 2022