{"id":22828754,"url":"https://github.com/mjmsmith/gcdswift","last_synced_at":"2025-04-23T16:24:37.267Z","repository":{"id":17622840,"uuid":"20427055","full_name":"mjmsmith/gcdswift","owner":"mjmsmith","description":"Swift wrapper for Grand Central Dispatch","archived":false,"fork":false,"pushed_at":"2021-07-23T16:26:33.000Z","size":20,"stargazers_count":25,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T16:24:32.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/mjmsmith.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":"2014-06-03T02:29:54.000Z","updated_at":"2025-02-24T07:12:44.000Z","dependencies_parsed_at":"2022-11-28T10:39:24.603Z","dependency_job_id":null,"html_url":"https://github.com/mjmsmith/gcdswift","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjmsmith%2Fgcdswift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjmsmith%2Fgcdswift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjmsmith%2Fgcdswift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjmsmith%2Fgcdswift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjmsmith","download_url":"https://codeload.github.com/mjmsmith/gcdswift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250468775,"owners_count":21435538,"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-12-12T19:12:02.888Z","updated_at":"2025-04-23T16:24:37.250Z","avatar_url":"https://github.com/mjmsmith.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCDSwift\n\n## GCDSwift is no longer supported. For iOS 10+, use the [Dispatch](https://developer.apple.com/reference/dispatch) framework.\n\nGCDSwift is a Swift wrapper for the most commonly used features of Grand Central Dispatch.  It has four main aims:\n\n* Organize the flat C API into appropriate classes.\n* Use intention-revealing names to distinguish between synchronous and asynchronous functions. \n* Use more convenient arguments such as time intervals.\n* Add convenience methods.\n\n__GCDSwift__ defines the same API as [GCDObjC](https://github.com/mjmsmith/gcdobjc).\n\n## Usage\n\n__GCDSwift__ requires Swift 2.0.\n\nFor usage examples, see [GCDSwiftTests.swift](https://github.com/mjmsmith/gcdswift/blob/master/GCDSwiftTests/GCDSwiftTests.swift).\n\nInstall via CocoaPods:\n\n```ruby\npod \"GCDSwift\"\n```\n\n## GCDQueue\n\nQueues are implemented in the __GCDQueue__ class.\n\n* convenience accessors for global queues\n\n```swift\nclass var mainQueue: GCDQueue { get }\nclass var globalQueue: GCDQueue { get }\nclass var highPriorityGlobalQueue: GCDQueue { get }\nclass var lowPriorityGlobalQueue: GCDQueue { get }\nclass var backgroundPriorityGlobalQueue: GCDQueue { get }\n```\n\n* creating serial and concurrent queues\n\n```swift\nclass func serialQueue() -\u003e GCDQueue\nclass func concurrentQueue() -\u003e GCDQueue\n```\n\n* queueing blocks for asynchronous execution\n\n```swift\nfunc queueBlock(block: dispatch_block_t)\nfunc queueBlock(block: dispatch_block_t, afterDelay seconds: Double)\nfunc queueBlock(block: dispatch_block_t, inGroup group: GCDGroup)\n```\n\n* queueing blocks for synchronous execution\n\n```swift\nfunc queueAndAwaitBlock(block: dispatch_block_t)\nfunc queueAndAwaitBlock(block: ((Int) -\u003e Void), iterationCount count: Int)\n```\n\n* queueing barrier blocks for synchronous or asynchronous execution\n\n```swift\nfunc queueBarrierBlock(block: dispatch_block_t)\nfunc queueAndAwaitBarrierBlock(block: dispatch_block_t)\n```\n\n* queueing notify blocks on groups\n\n```swift\nfunc queueNotifyBlock(block: dispatch_block_t, inGroup group: GCDGroup)\n```\n\n* suspending and resuming a queue\n\n```swift\nfunc suspend()\nfunc resume()\n```\n\n## GCDSemaphore\n\nSemaphores are implemented in the __GCDSemaphore__ class.\n\n* creating semaphores\n\n```swift\nGCDSemaphore()\nGCDSemaphore(value: Int)\n```\n\n* signaling and waiting on a semaphore\n\n```swift\nfunc signal() -\u003e Bool\nfunc wait()\nfunc wait(seconds: Double) -\u003e Bool\n```\n\n## GCDGroup\n\nGroups are implemented in the __GCDGroup__ class.\n\n* creating groups\n\n```swift\nGCDGroup()\n```\n\n* entering and leaving a group\n\n```swift\nfunc enter()\nfunc leave()\n```\n\n* waiting on completion of a group\n\n```swift\nfunc wait()\nfunc wait(seconds: Double) -\u003e Bool\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjmsmith%2Fgcdswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjmsmith%2Fgcdswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjmsmith%2Fgcdswift/lists"}