Public functions

In Objective-C some APIs may wish to  expose own helper functions publicly. For concern and state procedures. Functions are great way to encapsulate like these behaviours. If you think they’re really useful, it may be worth making them available globally.

Interface File:

typedef NS_ENUM(NSUInteger, UserState) {

extern NSString *NSStringFromUserState(UserState state);

Implematation File

NSString *NSStringFromUserState(UserState state) {
    switch (state) {
        case UserState_Admin: return @"Admin";
        case UserState_Moderator: return @"Moderator";
        case UserState_SuperUser: return @"Super User";
        case UserState_Active: return @"Active User";
        case UserState_Deactive: return @"De-active User";
        default:return nil;
    return nil;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s