Skip to content

Commit

Permalink
fix DownAttributedString
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWoWander committed Jun 1, 2021
1 parent f44cf5f commit 0e7f41b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Down-Example/Down-SwiftUI-Example/DownAttributedString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 0e7f41b

Please sign in to comment.