Giter Site home page Giter Site logo

linhtran1788 / brynkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brynbellomy/brynkit

0.0 2.0 0.0 557 KB

Making Obj-C/iOS development a little less excruciating.

Home Page: http://brynbellomy.github.com/BrynKit

License: Do What The F*ck You Want To Public License

brynkit's Introduction

// BrynKit

what

a collection of macros and other helpers that have made developing in objective-c and iOS less excruciating.

settable settings

  • VERBOSE_NSLOG: if set to 1, this will add the filename and line num to NSLog calls
  • SILENCE_NSLOG: if set to 1, all calls to NSLog become no-ops
  • LOG_MACROS_ARE_ACTIVE: easily turn off all changes to logging
  • NSLOG_TO_TESTFLIGHT: redirect all NSLog() calls to TFLog(), which sends them to TestFlight
  • AUTOMATIC_LOG_COLORS: automatically colorize NSLog() (or BrynLog(), as the case may be) output in the xcode console

debugging/logging macros

color logging for xcode's debug console

these macros are intended to make using the XcodeColors plugin (DeepIT/XcodeColors) easier.

predefined rgb colors

These macros evaluate to a regular NSString literal, so you can simply concatenate them into an NSString expression like so:

NSLog(@"Blah blah" COLOR_RED @"This will be red" XCODE_COLORS_RESET @"This will not");

  • COLOR_RED
  • COLOR_YELLOW
  • COLOR_OLIVE
  • COLOR_GREEN
  • COLOR_PURPLE
  • COLOR_BLUE

a predefined color logging "theme"

These are actual #define macros, accepting an NSString * argument. The reason is that they add an XCODE_COLORS_RESET after the passed argument.

  • COLOR_ERROR(str)
  • COLOR_SUCCESS(str)
  • COLOR_FILENAME(str)
  • COLOR_LINE(str)
  • COLOR_FUNC(str)

For example:

NSLog(COLOR_ERROR(@"You screwed up") @"... but it'll be okay.");

__JUST_FILENAME__

the built-in macro __FILE__ contains the entire path to a file. you don't often want that. this just gives you the file's actual name.

BrynLog(formatString, ...)

this is the macro that replaces NSLog if you have VERBOSE_NSLOG set to 1. if you want to use it without replacing NSLog, leave VERBOSE_NSLOG set to 0 and just call BrynLog. same syntax as NSLog().

BrynFnLog(formatString, ...)

just like BrynLog/NSLog except that it prefixes the log message with the function/selector name instead of the file and line num.

image-related macros

UIImageWithBundlePNG(filenameWithoutExtension)

load a PNG file from the main bundle. people use +[UIImage imageNamed:] because it's much easier than the (minimum) method calls you have to make to load a UIImage the 'right' way. with a macro like this, there's no excuse. note: the image filename you pass to this macro should not contain its file extension (".png").

container-related macros

SEObjectAtIndex(array, index)

calls [array objectAtIndex:index], but first checks to make sure that the array contains enough elements to even HAVE an object at the given index. warning: you may fail to notice bugs in your code when using this macro. exceptions get thrown for a reason, y'heard?

license (WTFPL v2)

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. You just DO WHAT THE FUCK YOU WANT TO.

brynkit's People

Contributors

brynbellomy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.