Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.
Jonathan Ellis edited this page Nov 25, 2013 · 6 revisions

All of the types are specified in the PGTransformers.m file in the source code.

All types are case insensitive, except for NSString and virtual properties which retain their case.

Primitives

int/NSInteger

Specified as-is, but in quotes. Example: "6"

double

Specified as-is, but in quotes. Example: "2.1"

float

Specified as-is, but in quotes. Example: "2.199104403883781"

BOOL

"yes" and "true" translate to YES. All other values translate to NO.

Structs

CGRect

Accepts a tuple as specified in CGRectFromString() format: "{{x,y}, {w,h}}" in screen coordinates where {x,y} is the origin and {w,h} is the width and height of the view. Example: "{{0,0}, {320,480}}" covers an iPhone screen.

Also accepts the shortcut "fullscreen" which is equivalent to [[UIScreen mainScreen] bounds].

CGSize

Accepts a tuple as specified in CGSizeFromString() format: "{w,h}" in screen coordinates. Example: "{100,100}" provides a 100x100 size.

Also accepts the shortcut "fullscreen" which is equivalent to [[UIScreen mainsScreen] bounds].size.

CGPoint

Accepts a tuple as specified in CGPointFromString() format: "{x,y}" in screen coordinates. Example: "{0,0}" is the point at the top-left of the screen.

Also accepts the shortcut "origin" which is equivalent to CGPointZero.

CGAffineTransform

Accepts a 6-tuple as specified in CGAffineTransformFromString() format: "{a, b, c, d, tx, ty}". Consult the SDK documentation for more info.

UIEdgeInsets

Accepts a 4-tuple as specified in UIEdgeInsetsFromString() format: "{top, left, bottom, right}". Consult the SDK documentation for more info.

Enums

You have two options when working with enumerated types. You can simply use the standard UIKit type names, for example UITextBorderStyleNone, or you can use the short-hand style where the common prefix is dropped and multiple words are separated with _. For example, for UITextBorderStyle, there are 4 possible values: UITextBorderStyleNone simply becomes "none", UITextBorderStyleBezel becomes "bezel" and UITextBorderStyleRoundedRect becomes "rounded_rect".

There are some exceptions to these rules, so you should tread carefully!

(Further documentation to follow, consult PGTransformers.m for now!)

Objects

NSString

Translated as-is. Example: "hello" becomes @"hello". Aside from some virtual properties, this is the only attribute that is case sensitive.

UIColor

There are two ways of specifying colors:

You can use the color name corresponding to the UIColor presets, e.g. "black" for [UIColor blackColor]. (Colors with multiple words like [UIColor darkGrayColor] can be specified as "dark_gray").

Alternatively, you can use HTML-style hex values to specify the color. For example, "#63ff1e" corresponds to a shade of lime green. (Note that you do need to provide the leading # so that the color is interpreted as hexadecimal).

UIImage

Specify the image filename, for example "monkey.png" corresponds to the file monkey.png which must be added to the project in Xcode.

(In a future release, you will be able to specify images as URLs, which makes building rich UIs on the serverside much more feasible).

UIFont

Accepts two values separated by a space.

The first value is the font name, which can either be the name of a font added to the project or can be "system" corresponding to the system font, or "system_bold" or "system_italic" corresponding to the system bold and italic fonts respectively.

The second value is a float with the font size specified in points.

For example, the value "system_bold 20" specifies that the bold system should be used with a size of 20 points.

Clone this wiki locally