{"id":1100,"url":"https://github.com/deput/RWPromiseKit","last_synced_at":"2025-07-30T20:31:16.951Z","repository":{"id":62452292,"uuid":"53737973","full_name":"deput/RWPromiseKit","owner":"deput","description":"A light-weighted Promise library for Objective-C","archived":false,"fork":false,"pushed_at":"2017-07-04T06:33:18.000Z","size":67,"stargazers_count":114,"open_issues_count":0,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-07-29T04:42:42.485Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/deput.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-03-12T15:16:33.000Z","updated_at":"2023-11-25T08:34:01.000Z","dependencies_parsed_at":"2022-11-01T23:46:07.987Z","dependency_job_id":null,"html_url":"https://github.com/deput/RWPromiseKit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deput%2FRWPromiseKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deput%2FRWPromiseKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deput%2FRWPromiseKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deput%2FRWPromiseKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deput","download_url":"https://codeload.github.com/deput/RWPromiseKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":215182685,"owners_count":15840918,"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:38.910Z","updated_at":"2024-08-13T13:30:36.108Z","avatar_url":"https://github.com/deput.png","language":"Objective-C","funding_links":[],"categories":["EventBus"],"sub_categories":["Getting Started","Other free courses","Linter"],"readme":"# RWPromiseKit\n\nDesiciption\n-------\n\nA light-weighted Promise library for Objective-C \n\n#### About Promise\n\n\u003eThe Promise object is used for deferred and asynchronous computations. A Promise represents an operation that hasn't completed yet, but is expected in the future.\n[Ref](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\n\nIn JavaScript, `Promise` handles asynchronising call beatifully:\n\n\n```js\ngetJSON(\"/posts.json\").then(function(posts) {\n  // ...\n  consume(posts);\n}).catch(function(error) {\n  console.log('something wrong！', error);\n});\n```\n\nUsage of RWPromiseKit\n-------\nHere is a basic example:\n```objc\nRWPromise* p1 = [RWPromise promise:^(ResolveHandler resolve, RejectHandler reject) {\n                  resolve(@\"result\");\n                }];\np1.then(^id(NSString* value){\n  NSLog(@\"%@\",value); //result\n  return @\"resultOfThen\";\n}).then(^id(NSString* value){\n  NSLog(@\"%@\",value); //resultOfThen\n  NSException *e = [NSException exceptionWithName:@\"name\"\n                                           reason:@\"reason\"\n                                         userInfo:@{}];\n  @throw e;\n  return nil;\n}).catch(^(NSError* error){\n  NSLog(@\"%@\",[error description]); //error contains exception\n});\n```\nUsing RWPromise is exactly same as using promise in js. `resolve` and `reject` are provided in initial block as input parameters, these two methods are used to change the state of a promise. Block passed in `then` will be invoked when a promise is set to resolved while one in `catch` will be invoked when rejected.\n\nFor more infomation about the API of promise in js, please reference [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\n\n### Suppoted API\n#### 0.1.0\n- `then`\n- `catch`\n- `finally`\n- `after`\n- `retry`\n- `timeout`\n- `map`\n- `filter`\n- `reduce`\n- `race`\n- `all`\n- `resolve`\n- `reject`\n \n#### 0.2.0\n- `progress`\n\n\n\nInstallation\n-------\n- Cocoapods\n```\npod 'RWPromiseKit', '0.2.0'\n```\n\n- Source code\n\nCopy all source files from directory `Class` to your project\n\nIssues and Todo list\n-------\n- I simplify the usage of `then` compared with js. Just pass only one handler block to handle when last promise is resolved. To reject, you can raise an expection or return a new promise.\n\n- ~~some other API: `map`,`filter`,`reduce`~~\n- Integrate with 3rd party lib\n- ~~Unit test are not finished~~\n- Complicated test cases. \n- Doc with more detail \n\n\nLicense\n-------\n\nLicensed under MIT. [Full license here \u0026raquo;](LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeput%2FRWPromiseKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeput%2FRWPromiseKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeput%2FRWPromiseKit/lists"}