From ae44ccc7325610b5dc7eaffa3f37228747d1f926 Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Tue, 27 Feb 2024 18:07:41 +0100 Subject: [PATCH 1/2] :technologist: (extensions): Add Text view init with markdown string hidding the need to init an AttributedString manually --- .../Sources/Extensions/Text+MarkdownInit.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Modules/GameEngineKit/Sources/Extensions/Text+MarkdownInit.swift diff --git a/Modules/GameEngineKit/Sources/Extensions/Text+MarkdownInit.swift b/Modules/GameEngineKit/Sources/Extensions/Text+MarkdownInit.swift new file mode 100644 index 0000000000..acac998222 --- /dev/null +++ b/Modules/GameEngineKit/Sources/Extensions/Text+MarkdownInit.swift @@ -0,0 +1,11 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import SwiftUI + +public extension Text { + init(markdown: String) { + self.init(.init(markdown)) + } +} From 7000e0f00e1c539580c5fa82175a22396e6ef87b Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Tue, 27 Feb 2024 18:08:59 +0100 Subject: [PATCH 2/2] :children_crossing: (GEK): Display shortDescription as markdown --- .../Sources/Views/Activity/ActivityDetailsView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/GameEngineKit/Sources/Views/Activity/ActivityDetailsView.swift b/Modules/GameEngineKit/Sources/Views/Activity/ActivityDetailsView.swift index 9ad9929dc1..bd5804fdfc 100644 --- a/Modules/GameEngineKit/Sources/Views/Activity/ActivityDetailsView.swift +++ b/Modules/GameEngineKit/Sources/Views/Activity/ActivityDetailsView.swift @@ -39,7 +39,7 @@ public struct ActivityDetailsView: View { .foregroundColor(.secondary) } - Text(self.activity.details.shortDescription) + Text(markdown: self.activity.details.shortDescription) .font(.subheadline) .foregroundColor(.secondary) }