Defining a struct and a “make” function in Objective-C

February 26, 2014

// Header (.h):
struct HButtonFillets {
    CGFloat topLeft;
    CGFloat topRight;
    CGFloat bottomRight;
    CGFloat bottomLeft;
};
typedef struct HButtonFillets HButtonFillets;

CG_INLINE HButtonFillets
HButtonFilletstMake(CGFloat topLeft, CGFloat topRight,CGFloat bottomRight,CGFloat bottomLeft)
{
    HButtonFillets buttonFillets;
    buttonFillets.topLeft = topLeft;
    buttonFillets.topRight = topRight;
    buttonFillets.bottomRight = bottomRight;
    buttonFillets.bottomLeft = bottomLeft;
    return buttonFillets;
}

Tags: , , ,