Skip to content

Instantly share code, notes, and snippets.

- (<#type#>)<#propertyName#> {
return [objc_getAssociatedObject(self, _cmd) <#NSNumberMethod#>];
}
- (void)set<#propertyName#>:(<#type#>)object
{
objc_setAssociatedObject(self, @selector(<#propertyName#>), [NSNumber numberWith:object], OBJC_ASSOCIATION_);
}
//
// UIScrollView+Extensions.h
//
//
@interface UIScrollView (Extensions)
/// Returns true if the content has been scrolled all the way to the top (by pulling the content up).
- (BOOL)isScrolledToTop;
//
// NSInvocation+SimpleCreation.h
// MAPI
//
// Created by Tiago Alves on 08/12/13.
// Copyright (c) 2013 Iterar. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UILabel (ContentSize)
- (CGSize)contentSize;
@end
//
// NSObject+Association.h
//
// Created by Maciej Swic on 03/12/13.
// Released under the MIT license.
//
#import <Foundation/Foundation.h>
@interface NSObject (Association)
static __inline__ CGRect CGRectFromCGSize( CGSize size ) {
return CGRectMake( 0, 0, size.width, size.height );
};
static __inline__ CGRect CGRectMakeWithCenterAndSize( CGPoint center, CGSize size ) {
return CGRectMake( center.x - size.width * 0.5, center.y - size.height * 0.5, size.width, size.height );
};
static __inline__ CGRect CGRectMakeWithOriginAndSize( CGPoint origin, CGSize size ) {
return CGRectMake( origin.x, origin.y, size.width, size.height );
#import <Foundation/Foundation.h>
@interface NSObject (Swizzle)
+ (void)swizzleInstanceSelector:(SEL)originalSelector
withNewSelector:(SEL)newSelector;
@end
//
// NSString+UsefulStuff.h
//
// Duane Sibilly <[email protected]>
// 6/21/11
// Copyright (c) 2011-2012 Duane Sibilly. All rights reserved.
#import <Foundation/Foundation.h>
// The use of the parenthesis in the interface declaration is what tells the
/*
Before:
CGRect frame = myView.frame;
frame.origin.x = newX;
myView.frame = frame;
After:
myView.x = newX;
/*
Before:
CGRect frame = myView.frame;
frame.origin.x = newX;
myView.frame = frame;
After:
myView.x = newX;