Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
struct ContentView: View {
var body: some View {
Text(makeAttributedString())
}
func makeAttributedString() -> AttributedString {
var string = AttributedString("Some Attributed String")
string.foregroundColor = .blue
if let range = string.range(of: "Attributed") { /// here!
string[range].foregroundColor = .red
}
return string
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment