Objective-C wrapper for the Gist API.
Just copy the files from the Classes
and Library
directories into your Xcode project. In the future I will provide a static library to download.
As of version 0.0.3, ObjectiveGist is ARC compliant.
Fetch a Gist from Github:
Gist* gist = [[Gist alloc] initWithId:@"gist id here"];
Now iterate through the files and show its contents:
NSArray* gistFiles = [gist files];
for (GistFile* file in gistFiles) {
NSLog(@"Content: %@", file.content);
}
In order to create or delete gists with ObjectiveGist, you must provide an Oauth access token that's supplied by Github. You can read about how Github uses Oauth here. The access token allows you to make requests to the API on a behalf of a user.
Once you have an access token, creating a gist is easy as pie:
GistFile* gistFile = [[GistFile alloc] initWithContent:@"puts 1+1"];
Gist* newGist = [[Gist alloc] init];
newGist.files = [NSArray arrayWithObject:gistFile];
newGist.gistDescription = @"print sum of 1+1 in Ruby";
[newGist publish:@"access token here"];
Destroying a gist will permanetely remove it from Github.
Gist* gist = [[Gist alloc] initWithId:@"gist id here"];
[gist destroy:@"access token here"];
One of the goals for ObjectiveGist is excellent test coverage. You can see the tests in the ObjectiveGistTests directory.
I use GitHub's issue tracker to track bugs and features. Before submitting an issue or feature request, please check to make sure it hasn't already been submitted. You can indicate support for an existing issue by voting it up. When submitting a bug report, please include your Xcode (with compiler) and OS X version.
You can view the upcoming features on Github.
ObjectiveGist is released under the MIT License.