This document describes methods in categories in detail. Categories are not in any particular order. To be updated.
Extensions to Apple's most used UI framework on iOS.
Makes displaying alert view very quick and easy.
- (instancetype)hay_initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle;
- (instancetype)hay_initWithTitle:(NSString *)title message:(NSString *)message delegate:(id <UIAlertViewDelegate>)delegate cancelButtonTitle:(NSString *)cancelButtonTitle;
+ (void)hay_showWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle;
+ (void)hay_showWithTitle:(NSString *)title message:(NSString *)message delegate:(id <UIAlertViewDelegate>)delegate cancelButtonTitle:(NSString *)cancelButtonTitle;
+ (void)hay_showWithTitle:(NSString *)title message:(NSString *)message delegate:(id <UIAlertViewDelegate>)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
A simple category for basic information about application.
- (long long)hay_memorySize;
- (NSUInteger)hay_threadCount;
- (float)hay_cpuUsage;
- (BOOL)hay_isRunningTests;
A category that helps by taking screenshots of application window.
- (UIImage *)hay_screenshot;
- (UIImage *)hay_screenshotExcludingWindows:(NSArray *)windows;
- (UIImage *)hay_screenshotExcludingWindows:(NSArray *)windows withStatusBar:(BOOL)statusBar;
UIApplication category that adds utility methods for application bundle.
- (NSString *)hay_name;
- (NSString *)hay_version;
- (NSString *)hay_build;
- (NSString *)hay_bundleIdentifier;
The UIButton always positions title label to the right of the image. In certain cases you want the title to be placed above or below the image. This category fixes the problem.
- (void)hay_setTitleBelowWithSpacing:(CGFloat)spacing;
An UIColor category that allows the creation of UIColors from Hex HTML strings and 8-bit colors.
+ (UIColor *)hay_colorWith8BitRed:(NSInteger)red green:(NSInteger)green blue:(NSInteger)blue alpha:(CGFloat)alpha;
+ (UIColor *)hay_colorWith8BitRed:(NSInteger)red green:(NSInteger)green blue:(NSInteger)blue;
+ (UIColor *)hay_colorWithHex:(NSString *)hex;
+ (UIColor *)hay_colorWithObject:(id)object;
+ (UIColor *)hay_colorWithName:(NSString *)name;
+ (NSArray *)hay_colorsWithName:(NSString *)name;
+ (id)hay_colorObjectWithName:(NSString *)name;
An UIColor category that encapsulates basic flat colors used in multiple applications.
+ (UIColor *)hay_turquoiseColor;
+ (UIColor *)hay_greenSeaColor;
+ (UIColor *)hay_emeraldColor;
+ (UIColor *)hay_nephritisColor;
+ (UIColor *)hay_peterRiverColor;
+ (UIColor *)hay_belizeHoleColor;
+ (UIColor *)hay_amethystColor;
+ (UIColor *)hay_wisteriaColor;
+ (UIColor *)hay_wetAsphaltColor;
+ (UIColor *)hay_midnightBlueColor;
+ (UIColor *)hay_sunFlowerColor;
+ (UIColor *)hay_carrotColor;
+ (UIColor *)hay_orangeFruitColor;
+ (UIColor *)hay_pumpkinColor;
+ (UIColor *)hay_alizarinColor;
+ (UIColor *)hay_pomegranateColor;
+ (UIColor *)hay_cloudsColor;
+ (UIColor *)hay_silverColor;
+ (UIColor *)hay_concreteColor;
+ (UIColor *)hay_asbestosColor;
This category extends the UIDevice functionality with additional information about current device.
- (BOOL)isiPhone;
- (BOOL)isiPod;
- (BOOL)isiPad;
- (BOOL)isRetina;
- (BOOL)isWidescreen;
- (NSString *)modelIdentifier;
- (NSString *)modelName;
- (UIDeviceFamily)deviceFamily;
- (BOOL)hasTouchID;
A convenience category that makes initialization of view controllers quick and easy from Storyboards.
+ (UIViewController *)hay_initialViewControllerInStoryboardWithName:(NSString *)name;
This category adds ability to find a parent UITableViewCell
or UICollectionViewCell
of any view, if the view is distant or close child of cell.
- (UITableViewCell *)hay_parentTableViewCell;
- (UICollectionViewCell *)hay_parentCollectionViewCell;
UIView category that adds different debugging outputs to UIView
that make debugging easier.
- (NSString *)hay_detailedDebugDescription;
UIView category that adds different debugging outputs to UIView
that make debugging easier.
- (UIView *)hay_parentViewOfType:(Class)class;
UIView category that creates an UIImage snapshot of the specific view.
- (UIImage *)hay_snapshotImage;
- (UIImage *)hay_snapshotImageWithScale:(CGFloat)scale;
A simple UIViewController category that enables the usage of a base background image in a view controller.
- (void)hay_setBackgroundImage:(UIImage *)image;
- (void)hay_setBackgroundImage:(UIImage *)image animated:(BOOL)animated;
- (UIImage *)hay_backgroundImage;
- (UIImageView *)hay_backgroundImageView;
Additions to the most core framework in iOS and OS X.
A category that adds convenience methods to NSArray
, NSDictionary
and NSSet
. Methods allow searching collections by object class or inherited class.
- (id)hay_firstObjectOfClass:(Class)objectClass;
- (id)hay_lastObjectOfClass:(Class)objectClass;
- (BOOL)hay_containsObjectOfClass:(Class)objectClass;
- (BOOL)hay_containsObjectOfInheritedClass:(Class)objectClass;
- (BOOL)hay_containsAllObjectsOfClass:(Class)objectClass;
- (BOOL)hay_containsAllObjectsOfInheritedClass:(Class)objectClass;
Implements Base64 string decoding.
- (NSString *)hay_base64String;
A category that adds Unix timestamp methods to NSDate
.
+ (NSTimeInterval)hay_unixTimestampFromDate:(NSDate *)date;
+ (NSTimeInterval)hay_timeIntervalUntilUnixTimeStamp:(NSTimeInterval)timestamp;
- (NSTimeInterval)hay_unixTimestamp;
+ (NSDate *)hay_dateWithUnixTimestamp:(NSTimeInterval)timestamp;
+ (NSTimeInterval)hay_unixTimestampForToday;
+ (NSTimeInterval)hay_unixTimestampDayForDate:(NSDate *)date;
Makes retrieving argument properties from invocations easy.
- (id)hay_objectAtIndex:(NSInteger)index;
Information about properties on certain class or object.
- (NSDictionary *)hay_properties;
+ (NSDictionary *)hay_properties;
Convenience methods for working with property lists.
- (BOOL)hay_isPropertyList;
Convenience methods for runtime inspection.
+ (NSArray *)hay_subclasses;
- (NSArray *)hay_subclasses;
+ (NSArray *)hay_subclassesOfClass:(Class)parentClass;
Easy and simple method swizzling category.
+ (void)hay_swizzleInstanceMethod:(SEL)firstMethod withMethod:(SEL)secondMethod;
+ (void)hay_swizzleClassMethod:(SEL)firstMethod withMethod:(SEL)secondMethod;
+ (void)hay_swizzleInstanceMethod:(SEL)firstMethod withMethod:(SEL)secondMethod inClass:(Class)class;
+ (void)hay_swizzleClassMethod:(SEL)firstMethod withMethod:(SEL)secondMethod inClass:(Class)class;
Adds certain methods to NSString
.
- (BOOL)hay_endsWith:(NSString *)string;
- (BOOL)hay_startsWith:(NSString *)string;
- (NSUInteger)hay_numberOfOccurencesOfString:(NSString *)string;
Generate strings with random characters.
+ (NSString *)hay_randomAlphaNumericStringOfLength:(NSUInteger)length;
+ (NSString *)hay_randomAlphaStringOfLength:(NSUInteger)length;
+ (NSString *)hay_randomStringOfLength:(NSUInteger)length;
+ (NSString *)hay_UUID;
Validate string with for basic use cases.
- (BOOL)hay_isValidEmail;
- (BOOL)hay_isValidEmailWithStrictFilter:(BOOL)strict;
Adds parameter manipulating methods to NSURL
.
- (NSDictionary *)hay_queryParameters;
- (NSURL *)hay_urlByAppendingParameter:(NSString *)parameter value:(NSString *)value;
- (NSURL *)hay_urlByAppendingParameters:(NSDictionary *)parameters;