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 UIKit; | |
@interface UIView (QuickLook) | |
@end | |
@implementation UIView (QuickLook) | |
- (id)debugQuickLookObject { | |
return self; |
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
Pod::Spec.new do |s| | |
s.name = "ReactiveCocoa" | |
s.version = "2.0.0dev" | |
s.summary = "A framework for composing and transforming sequences of values." | |
s.homepage = "https://github.com/blog/1107-reactivecocoa-is-now-open-source" | |
s.author = { "Josh Abernathy" => "[email protected]" } | |
s.source = { :git => "https://github.com/ReactiveCocoa/ReactiveCocoa.git", :branch => '2.0-development' } | |
s.license = 'Simplified BSD License' | |
s.description = "ReactiveCocoa offers:\n" \ | |
"1. The ability to compose operations on future data.\n" \ |
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
// Este código crea una referencia circular entre 'operation' y self | |
self.operation = [NSBlockOperation blockOperationWithBlock:^{ | |
[self doSomething]; | |
}]; | |
// Para evitarlo tenemos pasarle al bloque una referencia débil a self | |
typeof(self) __weak w_self = self; |
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 <UIKit/UIKit.h> | |
@class TGRTweet; | |
@class TGRProfileImageView; | |
@interface TGRTweetCell : UITableViewCell | |
@property (strong, nonatomic) TGRProfileImageView *profileImageView; | |
@property (strong, nonatomic) UILabel *nameLabel; | |
@property (strong, nonatomic) UILabel *dateLabel; |
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 <UIKit/UIKit.h> | |
@interface TGRProfileImageView : UIView | |
- (void)setProfileImageURL:(NSURL *)url; | |
- (void)cancelCurrentImageLoad; | |
@end |
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
- (void)controller:(NSFetchedResultsController *)controller | |
didChangeObject:(id)anObject | |
atIndexPath:(NSIndexPath *)indexPath | |
forChangeType:(NSFetchedResultsChangeType)type | |
newIndexPath:(NSIndexPath *)newIndexPath | |
{ | |
// Aquí podemos utilizar los métodos de UITableView para | |
// actualizar nuestra tabla | |
} |
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
NSFetchedResultsController *frc = [[NSFetchedResultsController alloc] initWithFetchRequest:[TGRTweet fetchRequestForAllTweets] | |
managedObjectContext:managedObjectContext | |
sectionNameKeyPath:nil | |
cacheName:nil]; |
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
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell *cell = ...; | |
TGRTweet *tweet = [self.fetchedResultsController objectAtIndexPath:indexPath]; | |
// Configuramos la celda usando los atributos del tweet | |
// ... | |
return cell; | |
} |
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
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
return [[self.fetchedResultsController sections] count]; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
return [[[self.fetchedResultsController sections] objectAtIndex:section] numberOfObjects]; | |
} |
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
+ (ACAccountStore *)tgr_sharedAccountStore | |
{ | |
static dispatch_once_t onceToken; | |
static ACAccountStore *accountStore; | |
dispatch_once(&onceToken, ^{ | |
accountStore = [[ACAccountStore alloc] init]; | |
}); | |
return accountStore; |