From 0e7f41bedeb5fbab4b1980310b439b57f40f811f Mon Sep 17 00:00:00 2001 From: Mikhail Date: Tue, 1 Jun 2021 16:49:55 +0300 Subject: [PATCH] fix DownAttributedString --- .../Down-SwiftUI-Example/DownAttributedString.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Down-Example/Down-SwiftUI-Example/DownAttributedString.swift b/Down-Example/Down-SwiftUI-Example/DownAttributedString.swift index 72d93da9..3a592f13 100644 --- a/Down-Example/Down-SwiftUI-Example/DownAttributedString.swift +++ b/Down-Example/Down-SwiftUI-Example/DownAttributedString.swift @@ -26,7 +26,7 @@ class MarkdownObservable: ObservableObject { let down = Down(markdownString: text) self.isLoading = true DispatchQueue(label: "markdownParse").async { - let attributedText = try? down.toAttributedString() + let attributedText = try? down.toAttributedString(styler: DownStyler()) DispatchQueue.main.async { self.textView.attributedText = attributedText @@ -47,9 +47,16 @@ struct MarkdownRepresentable: UIViewRepresentable { } func makeUIView(context: Context) -> UITextView { - - /// Allows you to adjust the alignment of the text markdownObject.textView.textAlignment = .left + markdownObject.textView.isScrollEnabled = false + markdownObject.textView.isUserInteractionEnabled = false + markdownObject.textView.showsVerticalScrollIndicator = false + markdownObject.textView.showsHorizontalScrollIndicator = false + markdownObject.textView.allowsEditingTextAttributes = false + markdownObject.textView.backgroundColor = .clear + + markdownObject.textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + markdownObject.textView.setContentCompressionResistancePriority(.defaultLow, for: .vertical) return markdownObject.textView }