Latest 0.0.6
Homepage https://github.com/greensn0w/objective-c-powerdefines
License MIT
Platforms ios
Authors

objective-c-powerdefines

Some handy defines for objective-c that make coding a lot easier

How to install

Put this in your Podfile:

pod "powerdefines"

Usage

Just include the powerdefines anywhere in your project like this:

#include <powerdefines/powerdefines.h>

Defines

Switch NSStrings! ^-^/

#define SWITCH PD_SWITCH
#define CASE PD_CASE
#define DEFAULT PD_DEFAULT

SWITCH(myColor){
  CASE(@"GREEN"){
    NSLog(@"YEAH GREEN!!!");
  }

  DEFAULT {
    NSLog(@"Nope. I hate %@", myColor);
  }
}

Define colors with one simple command!

myColor = PD_COLOR_RGBA(R, G, B, A);
myColor = PD_COLOR_RGB(R, G, B);
myColor = PD_COLOR_HEX(C);

A improved NSLog for more debug information

//If DEBUG is defined PD_LOG will output more debug information
//like line numbers and more
#define DEBUG
PD_LOG(@"App crash expected :|");
//If no DEBUG is defined PD_LOG will be an alias of NSLog
PD_LOG(@"App crash expected :|");

Manipulate the network-activity indicator

//Turn it on
PD_NETWORK_ACTIVITY_INDICATIOR_SHOW()

//Turn it off
PD_NETWORK_ACTIVITY_INDICATIOR_HIDE()

//Or set a BOOL
PD_NETWORK_ACTIVITY_INDICATIOR_VISIBLE(x)  

Get & Compare the iOS version

if(PD_SYSTEM_VERSION_EQUAL_TO(v)){...}

if(PD_SYSTEM_VERSION_GREATER_THAN(v)){...}

if(PD_SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)){...}

if(PD_SYSTEM_VERSION_LESS_THAN(v)){...}

if(PD_SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)){...}

Get the device type

if(PD_DEVICE_IS_IPAD){...}

if(PD_DEVICE_IS_IPHONE){...}

Check if the Device supports Retina

if(PD_DEVICE_HAS_RETINA_SCREEN){...}

Check if the device supports multitasking

if(PD_DEVICE_SUPPORTS_MULTITASKING){...}

Invalidate and nil a timer

PD_INVALIDATE_TIMER(myTimer);

Access the AppDelegate

PD_APP_DELEGATE

Log the bounds of a view

PD_LOG_BOUNDS(view)

Log the frame of a view

PD_LOG_FRAME(view)

Cast a BOOL to NSString

NSString *result = PD_BOOL_TO_STRING(myBool);

This documentation is not fully complete and i will extend it soon.

Latest podspec

{
    "name": "powerdefines",
    "version": "0.0.6",
    "summary": "Some handy defines for objective-c that make coding a lot easier",
    "description": "Powerdefines is a collection of handy defines for objective-c to make coding easier.nWith powerdefines you can switch NSStrings or get the iOS Version simple and fast.nLook into the GitHub README.md for a full Guide and the list of defines.",
    "homepage": "https://github.com/greensn0w/objective-c-powerdefines",
    "license": "MIT",
    "authors": {
        "Lukas Breuer": "[email protected]"
    },
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/greensn0w/objective-c-powerdefines.git",
        "tag": "0.0.6"
    },
    "source_files": "src/**/*.{h,m}"
}

Pin It on Pinterest

Share This