{"id":1153,"url":"https://github.com/mitchtreece/Threader","last_synced_at":"2025-07-30T20:32:35.106Z","repository":{"id":56924216,"uuid":"57229478","full_name":"mitchtreece/Threader","owner":"mitchtreece","description":"Pretty GCD calls and easier code execution.","archived":false,"fork":false,"pushed_at":"2016-10-11T17:48:12.000Z","size":67,"stargazers_count":35,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-12T11:44:06.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitchtreece.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-27T16:39:16.000Z","updated_at":"2022-09-09T11:58:25.000Z","dependencies_parsed_at":"2022-08-21T05:20:43.876Z","dependency_job_id":null,"html_url":"https://github.com/mitchtreece/Threader","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchtreece%2FThreader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchtreece%2FThreader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchtreece%2FThreader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchtreece%2FThreader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchtreece","download_url":"https://codeload.github.com/mitchtreece/Threader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228187539,"owners_count":17882322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:40.060Z","updated_at":"2024-12-04T20:31:02.375Z","avatar_url":"https://github.com/mitchtreece.png","language":"Swift","readme":"# Threader\nPretty GCD calls and easier code execution.\n\n[![Version](https://img.shields.io/cocoapods/v/Threader.svg?style=flat)](http://cocoapods.org/pods/Threader)\n[![License](https://img.shields.io/cocoapods/l/Threader.svg?style=flat)](http://cocoapods.org/pods/Threader)\n[![Platform](https://img.shields.io/cocoapods/p/Threader.svg?style=flat)](http://cocoapods.org/pods/Threader)\n\n## Overview\nThreader makes GCD calls easy to read \u0026 write. It also provides a simple way to execute code where and when you want.\n\n## Installation\n### CocoaPods\nThreader is integrated with CocoaPods!\n\n1. Add the following to your `Podfile`:\n```\nuse_frameworks!\npod 'Threader'\n```\n2. In your project directory, run `pod install`\n3. Import the `Threader` module wherever you need it\n4. Profit\n\n### Manually\nYou can also manually add the source files to your project.\n\n1. Clone this git repo\n2. Add all the Swift files in the `Threader/` subdirectory to your project\n3. Profit\n\n## Threader\nUsing `Threader` you can fine-tune where and how code get executed.\n\n```swift\nThreader.DispatchAsyncMain.execute {\n    /* Important main-thread code */\n}\n```\n\nThe above simply executes the code within the block on the main-thread. Naturally, `Threader` also provides other execution options:\n\n- **Immediate** - executes the code block immediately on the current thread.\n- **DispatchAsync** - executes the code block asynchronously on a given `DispatchQueue`.\n- **DispatchAsyncMain** - executes code block asynchronously on the main thread.\n- **DispatchAsyncGlobal** - executes the code block asynchronously on the global-queue.\n- **DispatchAsyncAfter** - executes the code block asynchronously at a specified `DispatchTime`, on a `DispatchQueue`.\n- **DispatchAsyncBarrier** - executes the code block asynchronously blocking on a given `DispatchQueue`.\n- **DispatchSync** - executes the code block synchronously on a given `DispatchQueue`.\n- **DispatchSyncBarrier** - executes the code block synchronously blocking on a given `DispatchQueue`.\n- **Operation** - executes the code block on a given `OperationQueue`.\n- **Block** - executes code from a closure.\n- **Default** - executes code on the current thread, _or_ on a global `DispatchQueue` depending on the block of code's current position in the thread.\n\nDispatching code to a given queue is as easy as:\n\n```swift\nlet queue = DispatchQueue.global()\nThreader.DispatchAsync(queue).execute {\n    /* Important background-thread code */\n}\n```\n\nIt can even be simplified further:\n\n```swift\nThreader.DispatchAsync(.global()).execute {\n    /* Important background-thread code */\n}\n```\n\n## DispatchQueue\nIn previous versions of Threader, `DispatchQueue` was a small wrapper around C-based GCD calls. However, as of __Swift 3__,\nApple decided to provide their own solution. Not surprisingly, the also named their wrapper `DispatchQueue`.\nMoving forward, Threader will use Apple's native implementation of `DispatchQueue` for all GCD related calls.\n","funding_links":[],"categories":["GCD","WebSocket"],"sub_categories":["Getting Started","Other free courses","Linter"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchtreece%2FThreader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchtreece%2FThreader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchtreece%2FThreader/lists"}