I'm wondering what the best way is for dealing with with nested tags. for instance, if i have <strong><em>Hello!</em></strong>, I'd like for "Hello!" to be both bolded and italicized, but the most deeply nested tag wins the day with my current approach (i.e. the hello example is italicized but not bolded). This is what I have:
let baseStyle = Style {...}
let boldStyle = baseStyle.byAdding {
$0.traitVariants = $0.traitVariants?.union(.bold) ?? .bold;
// have also tried $0.traitVariants = .bold, same effect
}
let italicStyle = baseStyle.byAdding {
$0.traitVariants = $0.traitVariants?.union(.italic) ?? .italic
// have also tried $0.traitVariants = .italic, same effect
}
let xmlStyle = SyleXML(base: baseStyle, ["strong": strongStyle, "em": italicStyle])
I'm a bit of an iOS noob; any direction here is much appreciated.
Hello!
<strong><em>Hello!</em></strong>
, I'd like for "Hello!" to be both bolded and italicized, but the most deeply nested tag wins the day with my current approach (i.e. the hello example is italicized but not bolded). This is what I have:I'm a bit of an iOS noob; any direction here is much appreciated.
Thanks again!