gonzalezreal / swift-markdown-ui

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

Markdown view doesn't update when Document changes #30

Closed santi-g-s closed 3 years ago

santi-g-s commented 3 years ago

My situation is as follows:

I change the contents of the the Markdown view programatically and the view doesn't update. To illustrate:

@State var markdownText = ""

var body: some View {
   HStack {
       Markdown(Document(markdownText))

      // It does when Markdown is replaced with Text
      Text(markdownText)
   }
}

I assume this is expected behaviour as private let document: Document does not have @Binding in Markdown.swift

Do you have any idea how this could be made to work, could document become a @Binding ?

Many thanks.

gonzalezreal commented 3 years ago

🤔 I don't think it is related to bindings. I will have a look at it over the weekend. Thanks for reporting it.

santi-g-s commented 3 years ago

🤔 I don't think it is related to bindings. I will have a look at it over the weekend. Thanks for reporting it.

Thanks!