RPOFoundation 0.0.5

RPOFoundation 0.0.5

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jul 2015

Maintained by Roberto Pastor.



What is this?

Coding is a repetitive work, and coders must avoid repeat their code, as Don't Repeat Yourself principle says.

I still have many things to learn but experience and practice are more valuable when you share with the rest of the community and that's why I create RPOFoundation.

This is a little library with some categories and helpers used for write less code and more one-liners. You can use it if you think it fits in one of your projects or you can add your code to help me improve it.


What it does?

Right now, RPOFoundation has this classes:

DLog

A macro shorcut for NSLog

DLog(@"This is a log with the number %d", 7);

will log this in DEBUG and do nothing in RELEASE

-[ClassName methodName:](0x7fda90f0a520) This is a log with the number 7

DeviceCheck

A macro paremeter called thisIsAniPad who returns YES if is running on iPad and NO in any other case.

UIColor+Utils

Category with some extra methods

+ (UIColor *)colorWithRGB:(NSString *) rgbColor;
+ (UIColor *)colorWithRGB:(NSString *) rgbColor alpha:(float) alpha;

UIViewController+Utils

Category with some extra methods

-(BOOL)isNavigationController;
-(void)removeBackButtonText;
-(UIViewController *)pushToStoryboardNamed:(NSString *) storyboardName
                        withViewIdentifier:(NSString *) viewIdentifier
                   returningViewController:(nextViewControllerBlock) block;
-(UIViewController *)presentStoryboardNamed:(NSString *) storyboardName
                         withViewIdentifier:(NSString *) viewIdentifier
                    returningViewController:(nextViewControllerBlock) block;

ScreenFlowHelper

Screen switching helper based on Maquert's Sauron Project.

CoreDatahelper

A helper for the most common and simple Code Data operations.

+ (id) queryOneObjectWithEntityName:(NSString *)entityName
                          predicate:(NSPredicate *)predicate
                    sortDescriptors:(NSArray *)sortDescriptors
                            context:(NSManagedObjectContext *)context;
+ (id) queryOneObjectWithEntityName:(NSString *)entityName
                          predicate:(NSPredicate *)predicate
                            context:(NSManagedObjectContext *)context;
+ (NSArray *) queryObjectsWithEntityName:(NSString *)entityName
                               predicate:(NSPredicate *)predicate
                                 context:(NSManagedObjectContext *)context;
+ (NSArray *) queryObjectsWithEntityName:(NSString *)entityName
                               predicate:(NSPredicate *)predicate
                         sortDescriptors:(NSArray *)sortDescriptors
                                 context:(NSManagedObjectContext *)context;
+ (void)deleteAllObjectsWithEntityName:(NSString *)name inContext:(NSManagedObjectContext *)moc;
+ (void)deleteAllObjectsWithEntityNames:(NSArray *)names inContext:(NSManagedObjectContext *)moc;
+ (void)deleteAllObjectsWithEntities:(NSArray *)entities inContext:(NSManagedObjectContext *)moc;
+ (void)deleteAllObjectsWithEntityName:(NSString *)name predicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)moc;
+ (void)deleteAllObjectsWithEntityNames:(NSArray *)names predicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)moc;
+ (void)deleteAllObjectsWithEntities:(NSArray *)entities predicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)moc;
+ (BOOL)saveContext:(NSManagedObjectContext *)moc;
+ (BOOL)saveContext:(NSManagedObjectContext *)moc error:(NSError *)error;
+ (NSManagedObjectContext *)newMOCWithParent:(NSManagedObjectContext *)parentMoc;

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

RPOFoundation is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "RPOFoundation"

Author

Roberto Pastor, [email protected]

@Roberto_Pastor

License

RPOFoundation is available under the MIT license. See the LICENSE file for more info.