Skip to content

Instantly share code, notes, and snippets.

View jerrymarino's full-sized avatar

Jerry Marino jerrymarino

View GitHub Profile
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2013 Peter Steinberger. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
@jerrymarino
jerrymarino / MagicalRecordNoParents.m
Created July 22, 2013 15:24
Magical Record without parent contexts
//Also fine to use MR_coordinatorWithInMemoryStore
NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_newPersistentStoreCoordinator];
[NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator];
NSManagedObjectContext *defaultContext = [NSManagedObjectContext MR_newMainQueueContext];
defaultContext.persistentStoreCoordinator = coordinator;
[NSManagedObjectContext performSelector:@selector(MR_setDefaultContext:) withObject:defaultContext];
#import <objc/runtime.h>
#import <objc/message.h>
#import <QuartzCore/QuartzCore.h>
#define PROPERTY(propName) NSStringFromSelector(@selector(propName))
// A better assert. NSAssert is too runtime dependant, and assert() doesn't log.
// http://www.mikeash.com/pyblog/friday-qa-2013-05-03-proper-use-of-asserts.html
// Accepts both:
// - PSPDFAssert(x > 0);