Skip to content

basdvries/BDVCountryNameAndCode

Repository files navigation

BDVCountryNameAndCode

Easy way to get the prefix of phone numbers in a country and the name of the country (English). It took me quite a while to find some useful arrays on this world wide web, and figured it might be a useful implementation for some.

How to use

Add BDVCountryNameAndCode.h and BDVCountryNameAndCode.m to your project.

Get prefix of current locale of user:

BDVCountryNameAndCode *BDVCountryNameAndCode = [[BDVCountryNameAndCode alloc] init];
NSString *prefixOfCurrentLocale = [BDVCountryNameAndCode prefixForCurrentLocale]; // Returns "+1" for Canada

Get the name of the current country in the same way:

BDVCountryNameAndCode *BDVCountryNameAndCode = [[BDVCountryNameAndCode alloc] init];
NSString *nameOfCurrentLocale = [BDVCountryNameAndCode countryNameForCurrentLocale]; // Returns "Canada"

Get the image flag of current locale of user:

BDVCountryNameAndCode *BDVCountryNameAndCode = [[BDVCountryNameAndCode alloc] init];
UIImage *flagOfCurrentLocale = [BDVCountryNameAndCode countryFlagForCurrentLocale]; // Returns UIImage

Easy but convenient

TODO

  • Create podspec
  • Add new languages for [BDVCountryNameAndCode countryNameForCurrentLocale]

About

Get mobile prefix (+1 etc) based on current locale of user

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published