OTOperations - Useful Swift NSOperation and NSOperationQueue subclasses

Overview

OTOperations

CI Build Status Platforms - macOS | iOS | tvOS | watchOS License: MIT

Useful Swift NSOperation (Operation) and NSOperationQueue (OperationQueue) subclasses.

Scalable, thread-safe, and automatically fully progress-reporting for nested child operations.

  • Foundational
    • BasicOperation and BasicAsyncOperation
  • Closure-based
    • ClosureOperation and AsyncClosureOperation
    • InteractiveClosureOperation and InteractiveAsyncClosureOperation
  • Thread-safe atomic mutability
    • AtomicBlockOperation

Installation: Swift Package Manager (SPM)

Dependency within an Application

  1. Add the package to your Xcode project using Swift Package Manager
    • Select File → Swift Packages → Add Package Dependency
    • Add package using https://github.com/orchetect/OTOperations as the URL.
  2. Import the module in your *.swift files where needed.
    import OTOperations

Dependency within a Swift Package

  1. In your Package.swift file:

    dependencies: [
        .package(url: "https://github.com/orchetect/OTOperations", from: "1.0.0")
    ],
  2. @_implementationOnly prevents the methods and properties in OTOperations from being exported to the consumer of your SPM package.

    @_implementationOnly import OTOperations

Documentation

Most methods are implemented as category methods so they are generally discoverable.

All methods have inline help explaining their purpose and basic usage examples.

Author

Coded by a bunch of 🐹 hamsters in a trenchcoat that calls itself @orchetect.

License

Licensed under the MIT license. See LICENSE for details.

Contributions

Bug fixes and improvements are welcome. Please open an issue to discuss prior to submitting PRs.

You might also like...
Queues, timers, and task groups in Swift
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

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

⚡️ Fast async task based Swift framework with focus on type safety, concurrency and multi threading
⚡️ 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

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

The projects and materials that accompany the Modern Concurrency in Swift book

Modern Concurrency in Swift: Materials This repo contains all the downloadable materials and projects associated with the Modern Concurrency in Swift

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

Egg-Timer - Intermediate Swift Programming - Control Flow and Optionals

Egg-Timer Intermediate Swift Programming - Control Flow and Optionals What I lea

Edit images and video with async / await in Swift, powered by Metal.
Edit images and video with async / await in Swift, powered by Metal.

AsyncGraphics The core value type in AsyncGraphics is a Graphic. It's like an image, tho it can be used with various async methods. Documentation Swif

Comments
  • Add additional tests for progress labels calling `statusHandler`

    Add additional tests for progress labels calling `statusHandler`

    Currently progress labels will recursively update through the entire progress child tree under these conditions:

    • when a child progress is added to a parent progress
      • ie: when an operation is added to BasicOperationQueue or one of its subclasses
    • when a progress label changes (setting labelProgress.label) anywhere in the progress tree
    • when a child progress object deinits

    BasicOperationQueue.statusHandler is called when .status changes, which is generally under these conditions (this list may not be exhaustive):

    • when any of these KVO observers fire:
      • isSuspended
      • operationCount
      • progress.fractionCompleted
      • progress.isFinished

    Additional unit tests need to be added to test various scenarios and states of BasicOperationQueue with nested child operations to ensure that statusHandler is being called sufficiently to provide updates to changes in the aggregate progress label. Especially with concurrent child operations complete, and as they complete in a staggered fashion.

    enhancement 
    opened by orchetect 1
Releases(1.0.6)
Owner
Steffan Andrews
Coding since 1995. Professional composer for film & TV.
Steffan Andrews
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
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
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
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
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