Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with markdown render/convert to attribute string on macOS latest version #185

Closed
sirily11 opened this issue Oct 27, 2019 · 3 comments

Comments

@sirily11
Copy link

sirily11 commented Oct 27, 2019

Cannot use the either down.toAttributedString() and DownView on MacOS. The error was shown when using down.toAttributedString()
截屏2019-10-27上午3 33 30
And following error was thrown when using DownView
截屏2019-10-27上午3 35 52

The markdown string I use is simply a "Hello world" string. I also tried using the example from readme, but failed. The project also using swiftUI with NSViewRepresentable to wrap the DownView.

@sirily11
Copy link
Author

This also happens when using it in ios project

@sirily11
Copy link
Author

Ok. I got the solution. If you are using SwiftUI and bind this view using UIViewRepresentable or NSViewRepresentable, then toNSAttributedString should be running inside DispatchQueue.main.async. Otherwise, it will throw an error. I don't know the reason.

@iwasrobbed-ks
Copy link
Collaborator

Because UIKit doesn't work on background threads. This isn't just for SwiftUI, but iOS in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants