0

I'm using a custom actionsheet with some text displaying. With XCode 11.3 I can't use NSAttributedString.Key.foreground. It used to work before the update, but now I can't find a solution.

Screengrab with example of my problem

enter image description here

    let attributedMessageText = NSMutableAttributedString(
        string: description,
        attributes: [
            NSAttributedString.Key.paragraphStyle: paragraphStyle,
            NSAttributedString.Key.font: UIFont.systemFont(ofSize: 13.0),
            NSAttributedString.Key.foregroundColor: UIColor.red
        ]
    )

If I'm trying to change a background color, it turns gray too. Maybe someone already faced this problem?

Naresh
  • 16,698
  • 6
  • 112
  • 113
Essentia G.
  • 1
  • 1
  • 2

1 Answers1

0

It's never a good idea to use private API as they might change without notice. I guess you use something like this:

actionSheet.setValue(message, forKey: "attributedTitle")

that's why this doesn't work on iOS13.3. Unfortunately there is no legal way to change those color with the public APIs. But you're not alone or here is good recommendation

Vadim Nikolaev
  • 2,132
  • 17
  • 34