From 18e88b896a294c007076a48f29f6663d753811e7 Mon Sep 17 00:00:00 2001 From: Sjmarf <78750526+Sjmarf@users.noreply.github.com> Date: Thu, 4 Jan 2024 20:28:22 +0000 Subject: [PATCH] Update Markdown View.swift --- Mlem/Views/Shared/Markdown View.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Mlem/Views/Shared/Markdown View.swift b/Mlem/Views/Shared/Markdown View.swift index ac1a85eea..61cad42a2 100644 --- a/Mlem/Views/Shared/Markdown View.swift +++ b/Mlem/Views/Shared/Markdown View.swift @@ -220,8 +220,8 @@ struct MarkdownBlock: Identifiable { } struct MarkdownView: View { - @State private var text: String - @State private var blocks: [MarkdownBlock] + private let text: String + private let blocks: [MarkdownBlock] private let isNsfw: Bool private let replaceImagesWithEmoji: Bool @@ -235,13 +235,12 @@ struct MarkdownView: View { isInline: Bool = false, alignment: TextAlignment = .leading ) { - let text: String = isInline ? MarkdownView.prepareInlineMarkdown(text: text) : text - _text = .init(wrappedValue: text) + self.text = isInline ? MarkdownView.prepareInlineMarkdown(text: text) : text self.isNsfw = isNsfw self.replaceImagesWithEmoji = replaceImagesWithEmoji self.isInline = isInline self.alignment = alignment - _blocks = .init(wrappedValue: MarkdownView.parseMarkdownForImages(text: text)) + self.blocks = MarkdownView.parseMarkdownForImages(text: text) } var body: some View {