TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Guille Gonzalez.
Gig provides an asynchronous block-based Objective-C wrapper for the Twitter 1.1 API. It makes use of Mantle to model Twitter Platform objects and AFNetworking to perform the API requests.
Gig is very much work in progress. Models for Tweets, Users, Entities and Places are fully implemented. As for the API, Gig currently implements timeline and tweet related methods. The remaining methods will be implemented over time (pull requests are welcome!).
Gig uses the Accounts Framework to authenticate API requests. Simply initialize your client with an ACAccount
object and all the requests will be signed with that account.
GIGClient *client = [[GIGClient alloc] initWithAccount:account];
Use the -fetchTimeline:parameters:completion
method to fetch tweets from a Twitter timeline.
// Fetch the two most recent tweets in my home timeline
[client fetchTimeline:GIGTimelineHome parameters:@{
GIGCountKey : @2
} completion:^(NSArray *tweets, NSError *error) {
for (GIGTweet *tweet in tweets) {
NSLog(@"%@: %@", tweet.user.screenName, tweet.text);
}
}];
// Update status
[client updateStatusWithText:@"Hello world!!!" parameters:nil completion:^(GIGTweet *tweet, NSError *error) {
NSLog(@"statusID: %@", tweet.statusID);
}];
// Update status with media
NSData *data = UIImageJPEGRepresentation(picture, 1.0);
[client updateStatusWithText:@"Hello world!!!" media:data parameters:nil completion:^(GIGTweet *tweet, NSError *error) {
GIGMedia *media = tweet.entities.media[0];
NSLog(@"statusID: %@, mediaID: %@", tweet.statusID, media.mediaID);
}];
Guillermo Gonzalez
@gonzalezreal
Gig is released under the MIT license. See LICENSE.md.