Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created June 15, 2021 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/f6aa22ff5748a7d97f0fc5f2f76c4546 to your computer and use it in GitHub Desktop.
Save laevandus/f6aa22ff5748a7d97f0fc5f2f76c4546 to your computer and use it in GitHub Desktop.
var string = AttributedString(localized: "This contains my message attribute", including: \.myApp)
let start = string.startIndex
let end = string.characters.index(start, offsetBy: 4)
string[start..<end].myApp.message = Message(id: "message_id", value: "secret")
// print(string.runs):
// This {
// NSPresentationIntent = [paragraph (id 1)]
// NSLanguage = en
// secretMessage = Message(id: "message_id", value: "secret")
// }
// contains my message attribute {
// NSPresentationIntent = [paragraph (id 1)]
// NSLanguage = en
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment