This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface ACAccountStore (Twitter) | |
+ (ACAccountStore *)tgr_sharedAccountStore; | |
- (BOOL)tgr_twitterAccountAccessGranted; | |
- (void)tgr_requestAccessToTwitterAccountsWithCompletionHandler:(void (^)(BOOL granted, NSError *error))completionHandler; | |
- (NSArray *)tgr_twitterAccounts; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "TGRTweetCell.h" | |
. | |
. | |
. | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TGRTweetCell.m | |
// TwitterTimeline | |
// | |
// Created by guille on 23/10/12. | |
// Copyright (c) 2012 Guillermo Gonzalez. All rights reserved. | |
// | |
#import "TGRTweetCell.h" | |
#import "TGRTweet.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TGRProfileImageView.m | |
// TwitterTimeline | |
// | |
// Created by guille on 27/10/12. | |
// Copyright (c) 2012 Guillermo Gonzalez. All rights reserved. | |
// | |
#import "TGRProfileImageView.h" | |
#import "SDWebImageManagerDelegate.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "TGRTimelineViewController.h" | |
#import "TGRTimeline.h" | |
#import "TGRTweet.h" | |
#import "TGRTwitterUser.h" | |
#import "ACAccountStore+Twitter.h" | |
static NSString * const kTweetCellIdentifier = @"TweetCell"; | |
@interface TGRTimelineViewController () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on Standford's CoreDataTableViewController | |
#import <UIKit/UIKit.h> | |
#import <CoreData/CoreData.h> | |
@interface TGRFetchedResultsTableViewController : UITableViewController <NSFetchedResultsControllerDelegate> | |
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController; | |
@property (nonatomic) BOOL ignoreContentChanges; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSManagedObjectContext *)managedObjectContext | |
{ | |
if (!_managedObjectContext) { | |
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; | |
[_managedObjectContext setPersistentStoreCoordinator:self.persistentStoreCoordinator]; | |
} | |
return _managedObjectContext; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator | |
{ | |
if (!_persistentStoreCoordinator) { | |
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; | |
path = [path stringByAppendingPathComponent:self.account.username]; | |
NSURL *url = [NSURL fileURLWithPath:path]; | |
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:self.managedObjectModel]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSManagedObjectModel *)managedObjectModel | |
{ | |
if (!_managedObjectModel) { | |
NSString *path = [[NSBundle mainBundle] pathForResource:@"Twitter" ofType:@"mom"]; | |
if (!path) { | |
path = [[NSBundle mainBundle] pathForResource:@"Twitter" ofType:@"momd"]; | |
} | |
NSURL *url = [NSURL fileURLWithPath:path]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface TGRTimeline () | |
@property (nonatomic, readwrite) BOOL loading; | |
@property (strong, nonatomic) ACAccount *account; | |
// Core Data stack | |
@property (strong, nonatomic, readwrite) NSManagedObjectContext *managedObjectContext; | |
@property (strong, nonatomic) NSManagedObjectModel *managedObjectModel; | |
@property (strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; |