From 861a1235f568854b03850e3260df70942e062c4e Mon Sep 17 00:00:00 2001 From: Dan Fabulich Date: Sun, 17 May 2026 19:13:49 -0700 Subject: [PATCH] Set attributes on `AttributedString`s, add them together, & add `Text`s --- Sources/Showcase/TextPlayground.swift | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Sources/Showcase/TextPlayground.swift b/Sources/Showcase/TextPlayground.swift index d16fc86..268b84e 100644 --- a/Sources/Showcase/TextPlayground.swift +++ b/Sources/Showcase/TextPlayground.swift @@ -5,6 +5,22 @@ struct TextPlayground: View { var redaction: RedactionReasons = [] let markdownVar = "String `var` with markdown" + private var welcomeAttributedText: AttributedString { + var attributedString = AttributedString("Welcome to Skip") + attributedString.font = .system(size: 16) + attributedString.foregroundColor = .blue + attributedString.underlineStyle = .single + return attributedString + } + + private var concatenatedAttributedText: AttributedString { + var a = AttributedString("Hello ") + a.foregroundColor = .blue + var b = AttributedString("World") + b.foregroundColor = .green + return a + b + } + var body: some View { ScrollView { VStack(spacing: 16) { @@ -70,6 +86,10 @@ struct TextPlayground: View { .italic() #endif + Text(welcomeAttributedText) + Text(concatenatedAttributedText) + Text(verbatim: "Left ") + Text(verbatim: "Right") + Divider() Text("Wrap: This is some long text that should wrap when it exceeds the width of its frame")