Jaymon / OCOut

Objective-C Out

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OCOut

Objective-C out, continuing in the grand tradition of php out and python out.

If I install the pod, what do I get?

OCOUT(val)

Print out the variable name and the variable value.

NSString *val = @"foo bar";
OCOUT(val);

Will result in:

str = foo bar (ViewController:17)

OCOUT will print out almost any value, for example:

UIEdgeInsets ei = UIEdgeInsetsMake(10, 10, 10, 10);
OCOUT(ei);

NSRange range = NSMakeRange(0, 10);
OCOUT(range);

Will print out:

ei = {10, 10, 10, 10} (ViewController:20)
range = {0, 10} (ViewController:23)

OCBREAK(linecount)

Add one or more lines of *'s.

OCBREAK(5);

Will result in:

************************************************************
************************************************************
************************************************************
************************************************************
************************************************************
(ViewController:26)

OCHERE()

Print here and the line number, super handy when you need to see if code is being ran.

OCHERE();

Will result in:

here 28 (ViewController:28)

OCTRACE()

Simpler stack trace.

OCTRACE();

Will result in:

1.	[ViewController viewDidLoad]
2.	[UIViewController loadViewIfRequired]
3.	[UIViewController view]
4.	[UIWindow addRootViewControllerViewIfPossible]
5.	[UIWindow _setHidden:forced:]
6.	[UIWindowAccessibility _orderFrontWithoutMakingKey]
7.	[UIWindow makeKeyAndVisible]
8.	[UIApplication _callInitializationDelegatesForMainScene:transitionContext:]
9.	[UIApplication _runWithMainScene:transitionContext:completion:]
10.	[UIApplication workspaceDidEndTransaction:]
11.	[FBSSerialQueue _performNext]
12.	[FBSSerialQueue _performNextFromRunLoopSource]
13.	[UIApplication _run]
(ViewController:30)

Installation

Use Cocoapods. To install it, simply add the following line to your Podfile:

pod "OCOut"

License

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

Information

OCOut is based off the code from VTPG, it basically pulls out the piece of code written about here.

here is another approach to the problem (but way more code and didn't do obj-c properties):

About

Objective-C Out

License:MIT License


Languages

Language:Objective-C 95.8%Language:Ruby 4.2%