This file contains 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
- (UIStatusBarStyle) preferredStatusBarStyle { | |
// UIStatusBarStyleLightContent is only defined in the iOS7 SDK | |
#if __IPHONE_OS_MAX_ALLOWED 70000 | |
return UIStatusBarStyleLightContent; | |
#else | |
return UIStatusBarStyleBlackOpaque; | |
#endif | |
} | |
#endif |
This file contains 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
- (id)initWithCancelButtonTitle:(NSString *)cancelTitle otherButtonTitles:(NSString *)otherButtonTitles, ... { | |
if (self = [super init]) { | |
NSMutableArray *buttonTitles = [[NSMutableArray alloc] init]; | |
BRYEachArgumentBlock eachArgumentBlock = ^(NSString *title) { | |
[buttonTitles addObject:title]; | |
}; | |
BRYVarArgs(eachArgumentBlock, otherButtonTitles); | |
} |
This file contains 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
/* MyModelObject.h */ | |
@interface MyModelObject : NSObject | |
// this data is "publicly" immutable | |
@property (nonatomic, readonly) NSArray *someData; | |
@end |
This file contains 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
- (BRYDescriptionBuilder *)appendInteger:(NSInteger)integer withName:(NSString *)name { | |
#if defined(__LP64__) && __LP64__ | |
return [self appendString:[NSString stringWithFormat:@"%li", integer] withName:name]; | |
#else | |
return [self appendString:[NSString stringWithFormat:@"%i", integer] withName:name]; | |
#endif | |
} | |
- (BRYDescriptionBuilder *)appendUnsignedInteger:(NSUInteger)unsignedInteger withName:(NSString *)name { | |
#if defined(__LP64__) && __LP64__ |
This file contains 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
// | |
// NSObject+PRKeyValueObserving.h | |
// PRKeyValueObserving | |
// | |
// Created by Paul Rehkugler on 3/8/14. | |
// Copyright (c) 2014 Paul Rehkugler. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains 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
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 | |
#define IOS7_CODE_WITH_FALLBACK(iOS7_code, other_code) \ | |
do { \ | |
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {\ | |
iOS7_code \ | |
}\ | |
else { \ | |
other_code \ | |
} \ |
This file contains 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
// SomeProtocol.h | |
@protocol SomeProtocol <NSObject> | |
- (void) protocolMethod; | |
@end | |
// NSObject+SomeProtocolDefaultImplementation.h | |
@interface NSObject(SomeProtocolDefaultImplementation) |
This file contains 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
// trying to make a block pointer | |
typedef void (^DoingBadStuffWithBlocks)(); | |
DoingBadStuffWithBlocks *theCompilerHatesThis = &^{ | |
if (false) | |
{ | |
*theCompilerHatesThis(); | |
} | |
}(); |
This file contains 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
// Follow up to - https://gist.github.com/paulrehkugler/11063725 | |
BOOL baseCaseCondition = NO; // obviously this should be data driven, not hardcoded | |
typedef void (^RecursiveBlock)(void (^)()); | |
RecursiveBlock aRecursiveBlock; | |
aRecursiveBlock = ^(RecursiveBlock block){ | |
if ((baseCaseCondition) && block) | |
{ |
OlderNewer