This little ObjectiveC category turns any given country code in an NSString
to a Unicode Flag Emoji that can be directly used wherever you want.
NSString * strIndia = @"IN";
NSLog(@"India's flag:%@",[NSLocale emojiFlagForISOCountryCode:strIndia]);
//Outputs:
India's flag: 🇮🇳
This category is essentially a copy-paste reproduction of this Stack Overflow answer.
To run the example project, clone the repo, and run pod install
from the Example directory first.
TTEmojiFlagString is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "TTEmojiFlagString"
Dhiraj Gupta, [email protected]
TTEmojiFlagString is available under the Apache 2.0 license. See the LICENSE file for more info.