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

Support for NSTextAttachment #14

Open
ngoleo opened this issue Mar 15, 2019 · 0 comments
Open

Support for NSTextAttachment #14

ngoleo opened this issue Mar 15, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@ngoleo
Copy link
Contributor

ngoleo commented Mar 15, 2019

Is your feature request related to a problem? Please describe.
It would be nice if we could support rendering an NSTextAttachment inside an attributed string, typically used to render icons inline with a label's text.

Describe the solution you'd like
When attributedText contains an NSTextAttachment, render the attachment image inline with the rest of the text, similar to how UILabel renders these.

Examples of usage:

Technical complexity

  • Rendering NSTextAttachment's in UILabel is likely managed by TextKit's NSLayoutManager, which we're bypassing and substituting with our own CoreText drawing in NantesLabel's implementation. Making it work with CoreText might not be practical/possible.

Describe alternatives you've considered

  • Just use UILabel itself, but you lose out on the benefits of NantesLabel. :D
  • Explore not overriding func drawText(in rect: CGRect) and let UILabel do the rendering. Not sure if we can do this and still support the current features.

Additional context

@ngoleo ngoleo added the enhancement New feature or request label Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant