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

How to render a tag based string #46

Closed
hunasdf opened this issue Sep 8, 2018 · 1 comment
Closed

How to render a tag based string #46

hunasdf opened this issue Sep 8, 2018 · 1 comment
Assignees
Labels

Comments

@hunasdf
Copy link

hunasdf commented Sep 8, 2018

Hi,

Is it support nested tags? For example:

<red><13>SomeText</13></red>

Thanks!

@malcommac
Copy link
Owner

malcommac commented Sep 20, 2018

Yeah for sure, but tag must start with a letter and not a number.

let baseStyle = Style {
	$0.font = UIFont.systemFont(ofSize: 20)
	$0.color = UIColor.black
}
let redStyle = Style {
	$0.color = UIColor.red
}
let pt13Style = Style {
	$0.font = UIFont.systemFont(ofSize: 13)
}

let group = StyleGroup(base: baseStyle, ["red": redStyle,"p13": pt13Style])
self.textView?.attributedText = "Hello <red><p13>World</p13></red>, Welcome In!".set(style: group)

@malcommac malcommac changed the title Nested tags How to render a tag based string Sep 20, 2018
@malcommac malcommac self-assigned this Sep 20, 2018
malcommac added a commit that referenced this issue Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants