Swift 4.2: [Swift._EmptyArrayStorage _getValue:forType:]: unrecognized selector Swift 4.2: [Swift._EmptyArrayStorage _getValue:forType:]: unrecognized selector swift swift

Swift 4.2: [Swift._EmptyArrayStorage _getValue:forType:]: unrecognized selector


I just found out what was wrong in the code.

So, because of the compiler error "'none' is unavailable: use [] to construct an empty option set", I replaced the NSUnderlineStyle.none.rawValue with [] 🤦‍♂️ And that's not the right case because it was using the rawValue, not the type none.

So, the fix is using 0.

Wrong: mutableAttributedString.addAttribute(NSAttributedString.Key.underlineStyle, value: [], range: range)

Right: mutableAttributedString.addAttribute(NSAttributedString.Key.underlineStyle, value: 0, range: range)