Lambdo-Labs / MDText

SwiftUI markdown
MIT License
131 stars 17 forks source link

Link layout issues #3

Open kevinrenskers opened 4 years ago

kevinrenskers commented 4 years ago

This is how the text is supposed to be laid out:

Screen Shot 2020-03-08 at 11 55 39

But this is what happens to links:

Screen Shot 2020-03-08 at 11 55 26 Screen Shot 2020-03-08 at 11 55 58
mralexhay commented 4 years ago

Also seeing this issue

andr-ec commented 4 years ago

Yes this is currently a limitation with SwiftUI. As soon as we add a modifier to text to allow for a clickable link, it becomes a view and we can no longer compose the text. So in this case links become their own line. We could fix this by dipping into UIKit for the links.

Unfortunately I don’t have a ton of time to look at this at the moment, but contributions are welcome!

brett-eugenelabs commented 4 years ago

I had a go at writing my own CommonMark Text widget in SwiftUI and also hit this problem, as Andre mentioned it is due to the way SwiftUI works, hopefully we get more support for attributed strings in SwiftUI 2.0 or even a wrap around stack which means we could mix Buttons and Text.

mralexhay commented 4 years ago

@acarrera94 that makes sense, thanks for the response 👍🏻

andr-ec commented 4 years ago

Looks like this might be possible in swiftUI. From blog and code.