I am building an iOS SDK to be consumed by apps. I am building an object that represents a physical place. The interface looks like so:
@interface RDPlace : NSObject
@property (nonatomic, strong, readonly) NSString *city;
@property (nonatomic, strong, readonly) NSString *country;
@property (nonatomic, strong, readonly) NSString *address;
@property (nonatomic, strong, readonly) NSString *zip;
@end
This is all working fine, but now I am attempting to make this work outside of the US. I found out that some places (Hong Kong was the one that prompted this discovery) don't have a zip code. I'm wondering what the best value to put in this SDK is. I believe I have 3 options:
- RDPlaces with no zip have the property set to nil
- RDPlaces with no zip have the property set to NSNull
- RDPlaces with no zip have the property set to @"" (empty string)
What is the most friendly for consumers of this object, and how would one annotate this for swift?
RDPlace
s are solely vended by the SDK, not created from scratch by clients? \$\endgroup\$ – jscs Mar 25 '16 at 20:25