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

Hyperlinks? #9

Open
antonjazz opened this issue Nov 19, 2020 · 7 comments
Open

Hyperlinks? #9

antonjazz opened this issue Nov 19, 2020 · 7 comments

Comments

@antonjazz
Copy link

You list hyperlinks under "Unsupported" rather than "Possibly Support in Future Versions", but I see the stub for the function
func link(textView: Text, destination: String?) -> Text.
Is there anything that can be done with it at this point? I can see how to use it to style the textView, but since the result is a Text view there's no way to add an .onTapGesture() modifier in the function, is there?

Thank you for this terrific package!

@dasautoooo
Copy link
Owner

Hi @antonjazz ,

The unsupported hyperlink is really annoying, however, by far there's no easy way to put a hyperlinked text inline with other styled-text, the only way to concatenate text is using Text. Once you add some modifier to the Text, it will convert to View, thus it is really difficult to combine those. I really hope Apple will support NSAttributedString in the next version of SwiftUI.

The reason Parma provides func link(textView: Text, destination: String?) -> Text method is because hyperlinks are super important. Parma gives a window for developers to gather destinations in order to use in other places.

Anyway, thanks for your feedback. And if you have any ideas of how to solve this problem, please let me know!

@antonjazz
Copy link
Author

Thank you for the response, @dasautoooo! I wish I had a suggestion. Fingers crossed for a way in upcoming version of SwiftUI. best wishes!

@Dennissimeau
Copy link

Dennissimeau commented Dec 3, 2020

Hey @dasautoooo, I really like your library and its customizability! I’ve also tried MDText, but it has not the customizability that you have, however it has the linking working. Can I suggest you in the very nicest way possible to have a look at that project, maybe it’ll help you in implementing it in your library.

Thank you so much for your work already!

@oblank
Copy link

oblank commented Apr 14, 2021

@Dennissimeau MDText can't generate a link inline, MarkdownUI do it perfectly.

@fjcaetano
Copy link

I get the necessity of returning Texts because these can be concatenated. But why don't links also have a linkBlock that returns any view, like headingBlock and paragraphBlock? This way, if we need to implement onTapGesture (or whatever other user interaction), we can add it to the link block instead of the link text itself.

@MoveUpwardsDev
Copy link

#22 let you customize the link.

@yensi-vega
Copy link

Hey there. I posted yesterday a PR to support inline links. Please give it a check you you have some time. Maybe it's not best way but at least it works. Also, please share any further suggestion/improvement to the approach.

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

No branches or pull requests

7 participants