Simple Task handler for iOS
- Task persistence across app restarts
- Start tasks with delay (simulating undo)
- Have tasks retriable
- Task viewer for debugging
- extensive logging support
- Swift 4.2+
- iOS 11+
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Forge into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'FlockForge',
- Create Forge and optionally listen to changes
let forge = Forge(with: "test")
let changeManager = TestChangeManager() // An object following `ChangeManager` protocol.
forge.changeManager = changeManager
- Add an executor to handle tasks for a particular type
let executor = TestExecutor() // An object following `Executor` protocol.
try! forge.register(executor: executor, for: "t") // Register executor for tasks with type "t"
- Create a task and submit to forge
let params = ["params": "params"]
let task = try! Task(id: "id", type: "t", params: params) // Create task
forge.submit(task: task)
-
[Optional] Presenting the Forge Tasks View Controller
- Create the View controller
let storyBoard = UIStoryboard(name: "ForgeTask", bundle: Bundle(for: Forge.self)) guard let forgeTasksVC = storyBoard.instantiateViewController(withIdentifier: "ForgeTasksViewController") as? ForgeTasksViewController else { fatalError("Could not instantiate TroubleshootController") }
- Present the created ViewController in your view heirarchy.
Note: To give it a spin, you can use the Tests project in Tests folder. Run pod install
before opening the workspace.
Please read architecture doc for more details.
Forge is available under the BSD 3-Clause license. See the LICENSE file for more info.