gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI
MIT License
2.26k stars 267 forks source link

Image Attachment not shown in UITextView with attributed string #36

Closed uuttff8 closed 3 years ago

uuttff8 commented 3 years ago

as title says, UITextView doesn't show images

here is example with images and UITextView

https://drive.google.com/drive/folders/1rwlJSGCEKnzW1biN6FCcjsrnNqH66S_3?usp=sharing

Please, correct me if I am wrong. Or suggest libraries that will show correct UITextView with images.

uuttff8 commented 3 years ago

And also, I can't use SwiftUI because of ios 12 support.

gonzalezreal commented 3 years ago

Hi @uuttff8,

This is the expected behaviour. Notice that the NSAttributedString extension does not load images asynchronously. Instead, it provides an optional attachments parameter that you can use to associate existing text attachments with image URL strings.

https://github.com/gonzalezreal/MarkdownUI/blob/079e08576d506fbc42184f175b2ca8a898da9a30/Sources/MarkdownUI/Shared/NSAttributedString%2BMarkdown.swift#L14