I don’t know if it’s possible to declare a variable in objective c with some predefined values.
For example I want my object “Location” to have a variable called type whose possible values are: “street”, “city” or “country”.
The idea is to access it with something like:
Location *myLoction = [[Location alloc] init]
myLocation.type = city;
and later do something like:
if(myLocation.type == street) {
//Do something here
}
Is that possible?
You are looking for enums:
You have to prefix the values, because you don’t have namespaces.