I have a superclass called City and a bunch of subclasses that inherit from this class. For example London and NewYork. Each of these subclasses have their own unique methods and instance variables.
When my app launches I geocode the current location and instantiate the subclass depending on which city I'm currently in.
Right now I have multiple properties defined to access these classes, so
@property (nonatomic, strong) London *london; @property (nonatomic, strong) NewYork *newYork; ... ... I will only ever need one object of this type in existence at any one time so would only like one property defined to access this object. Something like
@property (nonatomic, strong) City *city; Is there a way I can dynamically create the subclass I require without having to declare multiple properties?
LondonandNewYorkclasses. Why do you need specialized subclasses? Why not a genericCityclass that you can then query (similar to a dictionary, perhaps?) for specific information?