Skip to content

Instantly share code, notes, and snippets.

View coreyfloyd's full-sized avatar

Corey Floyd coreyfloyd

View GitHub Profile
@Tricertops
Tricertops / KVOCollection-Example.m
Last active August 29, 2015 14:01
Maybe the simplest way to implement Key-Value Observing compliant collection.
// This triggers correct KVO insertion notification:
[parent.mutableChildren addObject:@"Child"];
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active May 27, 2024 12:11
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. 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.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
@bignerdranch
bignerdranch / BNRTimeBlock.h
Created March 9, 2012 13:51
Timing Utility Post 20120308
CGFloat BNRTimeBlock (void (^block)(void));
@tjboudreaux
tjboudreaux / UINavigationBar+dropshadow.m
Created November 17, 2010 07:11
Applying a drop shadow to a UINavigationBar with a category.
@interface UINavigationBar (dropshadow)
-(void) applyDefaultStyle;
@end
@implementation UINavigationBar (dropshadow)
-(void)willMoveToWindow:(UIWindow *)newWindow{
[super willMoveToWindow:newWindow];