I’ve got an AttributedString
and I’m applying an orange color and strikethrough to a portion of the string.
var attributedpricestring = AttributedString("(yearlyfullpricestring)n(yearlyrealpricestring)")
let range = attributedpricestring.range(of: yearlyfullpricestring)!
attributedpricestring[range].foregroundColor = UIColor(named: "color-orange-highlight")
attributedpricestring[range].strikethroughStyle = .single
This code works fine, but is suddenly generating the following warning:
warning: cannot form key path that captures non-sendable type
'KeyPath<AttributeScopes.UIKitAttributes, AttributeScopes.UIKitAttributes.ForegroundColorAttribute>'
My project’s Swift Strict Concurrency Checking
is set to Minimal
, which I believe means that it should only warn about non-sendable warnings.
Why is it warning about a key path problem when trying to apply a style to a range of the AttributedString?