{"id":18271081,"url":"https://github.com/NimbusKit/sockit","last_synced_at":"2025-04-05T01:31:01.192Z","repository":{"id":62454163,"uuid":"2277086","full_name":"NimbusKit/sockit","owner":"NimbusKit","description":"String \u003c-\u003e Object Coder for Objective-C","archived":false,"fork":false,"pushed_at":"2017-03-20T16:36:15.000Z","size":67,"stargazers_count":421,"open_issues_count":10,"forks_count":47,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-30T01:53:57.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/jverkoey/SOCKit","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NimbusKit.png","metadata":{"files":{"readme":"README.mdown","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":"2011-08-26T23:09:10.000Z","updated_at":"2024-08-05T22:00:42.000Z","dependencies_parsed_at":"2022-11-02T00:00:56.028Z","dependency_job_id":null,"html_url":"https://github.com/NimbusKit/sockit","commit_stats":null,"previous_names":["jverkoey/sockit"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimbusKit%2Fsockit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimbusKit%2Fsockit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimbusKit%2Fsockit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimbusKit%2Fsockit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NimbusKit","download_url":"https://codeload.github.com/NimbusKit/sockit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276043,"owners_count":20912286,"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-11-05T11:39:03.898Z","updated_at":"2025-04-05T01:31:00.776Z","avatar_url":"https://github.com/NimbusKit.png","language":"Objective-C","readme":"SOCKit\n======\n\nString \u003c-\u003e Object Coding for Objective-C. Rhymes with \"socket\".\n\nWith SOCKit and [SOCPattern][] you can easily transform objects into strings and vice versa.\n\n### Two examples, cuz devs love examples.\n\n```obj-c\nSOCPattern* pattern = [SOCPattern patternWithString:@\"api.github.com/users/:username/gists\"];\n[pattern stringFromObject:githubUser];\n\u003e @\"api.github.com/users/jverkoey/gists\"\n```\n\n```obj-c\nSOCPattern* pattern = [SOCPattern patternWithString:@\"github.com/:username\"];\n[pattern performSelector:@selector(initWithUsername:) onObject:[GithubUser class] sourceString:@\"github.com/jverkoey\"];\n\u003e \u003cGithubUser\u003e username = jverkoey\n```\n\n### Hey, this is really similar to defining routes in Rails.\n\nDamn straight it is.\n\n### And isn't this kind of like Three20's navigator?\n\nExcept hella better. It's also entirely incompatible with Three20 routes. This kinda blows if\nyou've already invested a ton of energy into Three20's routing tech, but here are a few reasons\nwhy SOCKit is better:\n\n1. *Selectors are not defined in the pattern*. The fact that Three20 requires that you define\n   selectors in the pattern is scary as hell: rename a method in one of your controllers and\n   your URL routing will silently break. No warnings, just broke. With SOCKit you define the\n   selectors using @selector notation and SOCKit infers the parameters from the pattern definition.\n   This way you can depend on the compiler to fire a warning if the selector isn't defined anywhere.\n2. *Parameters are encoded using true KVC*. You now have full access to [KVC collection operators].\n3. *SOCKit is fully unit tested and documented*. Not much more to be said here.\n\nHere's a quick breakdown of the differences between Three20 and SOCKit, if SOCKit were used as\nthe backend for Three20's URL routing.\n\n```\nThree20: [map from:@\"twitter://tweet/(initWithTweetId:)\" toViewController:[TweetController class]];\nSOCKit:  [map from:@\"twitter://tweet/:id\" toViewController:[TweetController class] selector:@selector(initWithTweetId:)];\n\nThree20: [map from:[Tweet class] name:@\"thread\" toURL:@\"twitter://tweet/(id)/thread\"];\nSOCKit:  [map from:[Tweet class] name:@\"thread\" toURL:@\"twitter://tweet/:id/thread\"];\n```\n\n## Where it's being used\n\nSOCKit is a sibling project to [Nimbus][], a light-weight and modular framework that makes it\neasy to blaze a trail with your iOS apps.\n\nUsers of RESTKit will notice that SOCKit provides similar functionality to RESTKit's\n[RKMakePathWithObject][]. In fact, both `RKMakePathWithObject` and the underlying `RKPathMatcher`\nclass rely on SOCKit behind the scenes.\n\n## Adding SOCKit to your project\n\nThis lightweight library is built to be a dead-simple airdrop directly into your project. Contained\nin SOCKit.h and SOCKit.m is all of the functionality you will need in order to start mapping\nStrings \u003c-\u003e Objects. To start using SOCKit, simply download or `git checkout` the SOCKit repo\nand drag SOCKit.h and SOCKit.m to your project's source tree. `#import \"SOCKit.h\"` where you want\nto use SOCKit and start pumping out some mad String \u003c-\u003e Object coding.\n\n## Some cool things\n\nWhen coding objects into strings you define parameters by prefixing the property name with a colon.\nSo if you have a Tweet object with a `tweetId` property, the pattern parameter name would look like\n`:tweetId`. Simple enough.\n\nBut now let's say you have a Tweet object that contains a reference to a TwitterUser object via\nthe `user` property, and that TwitterUser object has a `username` property. Check this out:\n`:user.username`. If this was one of my tweets and I encoded the Tweet object using a SOCKit\npattern the resulting string would be `@\"featherless\"`. KVC rocks.\n\n## Learning more\n\nIn-depth documentation can be found in the [SOCKit.h][SOCPattern] header file.\n\n## Contributing\n\nIf you find a bug in SOCKit please file an issue on the Github [SOCKit issue tracker][]. Even\nbetter: if you have a solution for the bug then fork the project and make a pull request.\n\n[SOCKit issue tracker]: https://github.com/jverkoey/sockit/issues\n[SOCPattern]: https://github.com/jverkoey/sockit/blob/master/SOCKit.h\n[KVC collection operators]: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/KeyValueCoding/Articles/CollectionOperators.html#//apple_ref/doc/uid/20002176-BAJEAIEE\n[Nimbus]: http://jverkoey.github.com/nimbus\n[RESTKit]: https://github.com/RestKit/RestKit\n[RKMakePathWithObject]: https://github.com/RestKit/RestKit/blob/master/Code/Network/RKClient.m#L37","funding_links":[],"categories":["etc"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNimbusKit%2Fsockit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNimbusKit%2Fsockit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNimbusKit%2Fsockit/lists"}