Rightpoint / BonMot

Beautiful, easy attributed strings in Swift
MIT License
3.56k stars 197 forks source link

Parsing string like <em> some <red>important</red> text.</em> #351

Open phracek opened 5 years ago

phracek commented 5 years ago

Hi,

BonMot works great. It is really faster then attributedText. But I would like to highlight a text like

<em> some <red>important</red> text. </em>

Any idea, how to solve it?

Greetings

Petr

ZevEisenberg commented 5 years ago

This should work if you use XML attributes. If it's not working for you, could you please post some code demonstrating the problem?

ZevEisenberg commented 5 years ago

@phracek were you able to get this working?

phracek commented 5 years ago

Code for text generation is here: https://github.com/phracek/Katechismus_katolicke_cirkve_iOS/blob/develop/KatechismusKatolickeCirkve/KatechismusKatolickeCirkve/Utilities/GeneratorText.swift

Code for replacing text is: https://github.com/phracek/Katechismus_katolicke_cirkve_iOS/blob/develop/KatechismusKatolickeCirkve/KatechismusKatolickeCirkve/Controllers/ParagraphTableViewController.swift#L252

3rd item in my appliaction finds a word in database https://github.com/phracek/Katechismus_katolicke_cirkve_iOS/blob/develop/KatechismusKatolickeCirkve/KatechismusKatolickeCirkve/Supporting%20Files/database.json