Skip to content

Instantly share code, notes, and snippets.

@interface NSManagedObject (Serialization)
- (NSDictionary*) toDictionary;
- (void) populateFromDictionary:(NSDictionary*)dict;
+ (NSManagedObject*) createManagedObjectFromDictionary:(NSDictionary*)dict
inContext:(NSManagedObjectContext*)context;
@end
@seacatos
seacatos / getIndexPath
Created December 24, 2014 07:48
How to get index path from UICollectionViewCollection when a button inside the UICollectionViewCell is tapped.
- (IBAction)handleDeleteOrderButton:(UIButton *)sender forEvent:(UIEvent *)event {
UICollectionView *collectionView = self.collectionView;
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchPoint = [touch locationInView:collectionView];
NSIndexPath *indexPath = [collectionView indexPathForItemAtPoint:touchPoint];
...
@seacatos
seacatos / Exclude NSLog
Created December 8, 2014 09:56
Exclude NSLog statements in Release builds
#ifndef DEBUG
#define NSLog(...);
#endif
@seacatos
seacatos / xcode-version-bump
Created December 8, 2014 05:10
Auto-increment the version number (only) when a project is archived for export.
==== VERSION NUMBER ====
SemVer format [1.0.0]
# xcode-version-bump.sh
# @desc Auto-increment the version number (only) when a project is archived for export.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section