How to show Emoji in UILabel iOS
You can use ⌃ ⌘ Space
shortcut to show the symbols panels and just insert the emoji you're looking for directly without unicode:
lbl.text = @"Happy to help you ðº";
(just copy the code above to Xcode if you browser doesn't show the emoji)
NSString *str = @"Happy to help you \U0001F431";
NSData *data = [str dataUsingEncoding:NSNonLossyASCIIStringEncoding];
NSString *valueUnicode = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSData *dataa = [valueUnicode dataUsingEncoding:NSUTF8StringEncoding];
NSString *valueEmoj = [[NSString alloc] initWithData:dataa encoding:NSNonLossyASCIIStringEncoding];
_lbl.text = valueEmoj;
SWIFT - 3 OR HIGHER
let str = "Happy to help you \U0001F431"
let data : NSData = str.dataUsingEncoding(NSNonLossyASCIIStringEncoding)!
let valueUnicode : String = String(data: data, encoding: NSUTF8StringEncoding)!
let dataa : NSData = valueUniCode.dataUsingEncoding(NSUTF8StringEncoding)!
let valueEmoj : String = String(data: dataa, encoding: NSNonLossyASCIIStringEncoding)!
SWIFT - 4 OR HIGHER
let str = "Happy to help you \U0001F431"
let data : NSData = str.dataUsingEncoding(NSNonLossyASCIIStringEncoding)!
let valueUnicode : String = String(data: data as Data, encoding: String.Encoding.utf8)!
let dataa : NSData = valueUnicode.data(using: String.Encoding.utf8)! as NSData
let valueEmoj : String = String(data: dataa as Data, encoding: String.Encoding.nonLossyASCII)!