If you’ve worked with the Core Location class CLPlacemark, you might have noticed that despite having properties like ‘ISOCountryCode’ or ‘ocean’, there is not a property, nor an easy way to obtain its corresponding continent.
To solve this, I’ve programmed a small category on CLPlacemark that allows you to obtain its continent with a simple method:
NSString *continentForPlacemark = [paramPlacemark continent];
The continent is retrieved from a table using the ISOCountryCode property of the placemark. Also a simple Country-to-Continent decoder is available:
NSString *expectedContinent = [continentDecoder continentForCountryCode:@"PL"];
The name of this project is ‘Transcontinental‘ and is available as a MIT Licensed repository in Github. It also includes a simple example which should make its use clear as water.
Enjoy!