StyledTextKit icon indicating copy to clipboard operation
StyledTextKit copied to clipboard

Performance trade-off for using NSAttributedString with StyledTextBuilder

Open kylelol opened this issue 7 years ago • 1 comments

Just curious as if there is a performance tradeoff for creating an attributed string, and then using the convenience initializer of the StyledTextBuilder that takes in an attributed string vs just using the StyledTextedBuilder API to build up a string? Does this affect the background rendering as well?

kylelol avatar Jul 09 '18 16:07 kylelol

Would love to explore this idea a bit! The big downside with using an NSAttributedString is that you can't change any UIFont properties based on system text size. I originally designed this so that you can build a string once, but then render it multiple times when the device text size changes.

One idea brought up in #25 is to cache NSAttributedString building given string + content size input. That'd be win-win!

rnystrom avatar Jul 09 '18 18:07 rnystrom