Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 29, 2021. It is now read-only.

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

License

NotificationsYou must be signed in to change notification settings

intelygenz/Kommander-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kommander

TwitterVersionLicensePlatformSwiftCarthage compatibleSwift Package Manager CompatibleBuild StatusDocumentationDownloadsHelp Contribute to Open Source

Kommander is a Swift library to manage the task execution in different threads. Through the definition a simple but powerful concept,Kommand.

Inspired on the Java libraryKommander fromWokdsem.

Kommander

🌟 Features

  • Make kommand or multiple kommands
  • Execute kommand or multiple kommands
  • Cancel kommand or multiple kommands
  • Retry kommand or multiple kommands
  • Set kommand success closure
  • Set kommand error closure
  • Set kommand error closure specifying Error type
  • Main thread dispatcher
  • Current thread dispatcher
  • Custom OperationQueue dispatcher
  • Execute single or multiple Operation
  • Execute sequential or concurrent closures
  • Execute DispatchWorkItem
  • Kommand state
  • iOS compatible
  • watchOS compatible
  • tvOS compatible
  • macOS compatible
  • Swift 4 version
  • Swift 3 version
  • Swift 2 version
  • Objective-C version

📲 Installation

Kommander is available throughCocoaPods. To installit, simply add the following line to your Podfile:

pod'Kommander'

For Swift 3 compatibility use:

pod'Kommander','~> 0.7'

For Swift 2 compatibility use:

pod'Kommander',:git=>'https://github.com/intelygenz/Kommander-iOS.git',:tag=>'0.3.0-swift2'

For Objective-C compatibility use:

pod'Kommander',:git=>'https://github.com/intelygenz/Kommander-iOS.git',:tag=>'0.2.3-objc'

Or you can install it withCarthage:

github "intelygenz/Kommander-iOS"

Or install it withSwift Package Manager:

dependencies:[.package(url:"https://github.com/intelygenz/Kommander-iOS.git")]

🐒 Usage

Making, executing, cancelling and retrying Kommands:

Kommander().make{    // Your code here}.execute()
Kommander().make{    // Your code here}.execute(after:.seconds(2))
Kommander().make{return"Your string"}.success{ yourStringinprint(yourString)}.execute()
Kommander().make{throwCocoaError(.featureUnsupported)}.error{ errorinprint(String(describing: error!))}.execute()
Specify Error type:
Kommander().make{throwMyError.error}.error(MyError.self){ errorin    // error is MyError type.}.execute()
Retry after cancellation:
letkommand=Kommander().make{()->Any?in    // Your code here}.success{ resultin    // Your success handling here}.error{ errorin    // Your error handling here}.execute()kommand.cancel()kommand.retry()
Retry after failure:
letkommand=Kommander().make{()->Any?in    // Your code here}.error{ errorin    // Your error handling here}.retry{ error, executionCountinreturn executionCount<2}.execute()

Creating Kommanders:

Kommander(deliverer: Dispatcher=.current, executor: Dispatcher=.default)Kommander(deliverer: Dispatcher=.current, name: String, qos: QualityOfService=.default, maxConcurrentOperations: Int=.default)
Shortcuts:
Kommander.mainKommander.currentKommander.defaultKommander.userInteractiveKommander.userInitiatedKommander.utilityKommander.background

Creating Dispatchers:

CurrentDispatcher()MainDispatcher()Dispatcher(name: String, qos: QualityOfService=.default, maxConcurrentOperations: Int=.default)
Shortcuts:
Dispatcher.mainDispatcher.currentDispatcher.defaultDispatcher.userInteractiveDispatcher.userInitiatedDispatcher.utilityDispatcher.background

❤️ Etc.

  • Contributions are very welcome.
  • Attribution is appreciated (let's spread the word!), but not mandatory.

👨‍💻 Authors

alexruperez,alejandro.ruperez@intelygenz.com

juantrias,juan.trias@intelygenz.com

RobertoEstrada,roberto.estrada@intelygenz.com

👮‍♂️ License

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

About

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors6


[8]ページ先頭

©2009-2025 Movatter.jp