Class with defined static constant values in Objective-C -


i want create class contains static values accessable project.

pseudocode:

class constants:   constant string api_url : "http://api.service.com"   constant integer some_value : 7 

how can objective-c ?

you using preprocessors:

#define api_url @"http://api.service.com" #define some_value (7) 

accessing defines simple: [object do:api_url];

or use constants

nsstring * const apiurl = @"http://api.service.com"; nsnumber * const somevalue = @7; 

accessing consts accessing variables, string simple call. nsnumber object wrapper primitives you'd need access like: somevalue.intvalue


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -