There's no strong correlation... for example NSDiffableDataSourceSnapshot is available on iOS, tvOS, etc but not macOS. NSAttributedString
and its Key
are part of Foundation and it is available for iOS apps if needed (like NSString, NSMutableArray etc).
For decimal point, etc, try the snippet:
let color: UIColor? = if run.numberSymbol == .decimalSeparator {
.green
} else if run.measurement == .unit {
.orange
} else if run.numberPart == .fraction {
.blue
} else {
nil
}
if let color {
var attributes = run.attributes
attributes.merge(AttributeContainer([NSAttributedString.Key.foregroundColor : color]))
copy[run.range].setAttributes(attributes)
}