The type of `attributedText` is `NSAttributedString`, not `NSMutableAttributedString`.
`NSMutableAttributedString` is a subclass of `NSAttributedString`, so `attributedText` may return an `NSMutableAttributedString` in a certain condition. But it's an implementation detail, or in other words, just a luck.
Apps should not be programmed depending on a luck.
Until ios12 that code worked without problems.
You are mis-understanding. The code may have seemingly worked in the past, but it was just a luck, a big problem.
Any idea why this behaviour is changed
Implementation details would change at any time without notifications. Even a 0.0.0 security patch may change such behaviors.
how to fix the problem?
To get a mutable equivalent of an `NSAttributedString`, you use `mutableCopy()`.
let text = cell.statusTitleLabel.attributedText!.mutableCopy() as! NSMutableAttributedString
(You may want to avoid forced-something like `!` or `as!`, but that's another issue.)
Thanks a lot for your help, I've understood the difference you explained to me