Inserting SF Symbols in a string ?

Hello everyone,

That's for objective c


I would like to insert a sf symbo into a string for a title of a AlertViewController ?


UIAlertAction* mailAction = [UIAlertAction actionWithTitle:[@" " stringByAppendingString:NSLocalizedString(kSENDBYMAIL, @"")] style:UIAlertActionStyleDefault
                                                           handler:^(UIAlertAction * action)
    {
        [self createMail:alert];
    }];


I tryed as below but I know it's wrong, it's just to precise ma question ;-) :

UIAlertAction* mailAction = [UIAlertAction actionWithTitle:[[UIImage systemImage:@"envelope " stringByAppendingString:NSLocalizedString(kSENDBYMAIL, @"")] style:UIAlertActionStyleDefault
                                                           handler:^(UIAlertAction * action)
    {
        [self createMail:alert];
    }];


Thanks for a hint

Don

To save your time I copy-pasted Michcio's answer from the SO link posted by @Claude31 above:

let imageAttachment = NSTextAttachment()
imageAttachment.image = UIImage(systemName: "checkmark.circle")

// If you want to enable Color in the SF Symbols.
imageAttachment.image = UIImage(systemName: "checkmark.circle")?.withTintColor(.blue)

let fullString = NSMutableAttributedString(string: "Press the ")
fullString.append(NSAttributedString(attachment: imageAttachment))
fullString.append(NSAttributedString(string: " button"))
label.attributedText = fullString

Inserting SF Symbols in a string ?
 
 
Q