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
| // | |
| // SDMacros.h | |
| // walmart | |
| // | |
| // Created by Brandon Sneed on 7/11/13. | |
| // Copyright (c) 2013 Walmart. All rights reserved. | |
| // | |
| /** | |
| The __deprecated__ macro saves a little bit of typing around marking classes and methods as deprecated. |
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 <Foundation/Foundation.h> | |
| #import <objc/objc-runtime.h> | |
| @interface Foo : NSObject | |
| @end | |
| @implementation Foo |
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 <Foundation/Foundation.h> | |
| #import <objc/objc.h> | |
| #import <objc/runtime.h> | |
| #import <objc/message.h> | |
| int main(int argc, char *argv[]) { | |
| @autoreleasepool { | |
| Class stringClass = [NSString class]; | |
| NSLog(@"foo: %@", objc_msgSend(stringClass, @selector(stringWithFormat:), @"bar")); | |
| } |
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 UIView (SMFrameAdditions) | |
| @property (nonatomic, assign) CGPoint $origin; | |
| @property (nonatomic, assign) CGSize $size; | |
| @property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties | |
| @property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect | |
| @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
| @implementation UIView (NibLoadingExtension) | |
| + (id)viewFromNib | |
| { | |
| static NSMutableDictionary *caches = nil; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| caches = [[NSMutableDictionary dictionary] retain]; | |
| }); |
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
| NSCharacterSet *stripSet = [NSCharacterSet characterSetWithCharactersInString:@"."]; | |
| val1 = [[val1 componentsSeparatedByCharactersInSet:stripSet] componentsJoinedByString:@""]; | |
| val2 = [[val2 componentsSeparatedByCharactersInSet:stripSet] componentsJoinedByString:@""]; | |
| return [val1 compare:val2 options:NSNumericSearch | NSCaseInsensitiveSearch]; |
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
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(void) | |
| { | |
| // take snapshot of main view to fake background | |
| // | |
| // start with a vertical slice of the middle, slightly taller than modal | |
| // | |
| // translate & clip layer before rendering for performance | |
| // |
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
| static char *kMyAssociationKey = nil; | |
| - (void)setContext:(id)context | |
| { | |
| objc_setAssociatedObject(self, &kMyAssociationKey, context, OBJC_ASSOCIATION_ASSIGN); | |
| } | |
| - (id)context | |
| { | |
| return objc_getAssociatedObject(self, &kMyAssociationKey); |
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 MyClass () | |
| @property (nonatomic, retain) NSArray *myInternalArray; | |
| @property (nonatomic, retain) UIImage *myInternalImage; | |
| @end | |
| @implementation MyClass | |
| @synthesize myInternalArray; |