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

Fixed font/size attributes which are not inherited correctly #37

Closed
xdxavier opened this issue Jun 8, 2018 · 1 comment
Closed

Fixed font/size attributes which are not inherited correctly #37

xdxavier opened this issue Jun 8, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@xdxavier
Copy link

xdxavier commented Jun 8, 2018

add method will override all existing attributes.

let styleA = Style {
	$0.color = UIColor.white
	$0.size = 24
}

let styleB = Style {
	$0.color = UIColor.white
	$0.size = 14
}

let styleC = Style {
	$0.color = UIColor.red
}

let a = "hello".set(style: styleA)
let b = "world!".set(style: styleB)
let ab = (a + b).add(style: styleC)

the expected result of ab should keep different font size and append red color. But real result is reset font size and append red color.

p.s. version 2.0.1

@malcommac malcommac changed the title AttributedString add Methods not working Fixed font/size attributes which are not inherited correctly Sep 3, 2018
@malcommac
Copy link
Owner

Fixed.
Now font and size are correctly inherited when not specified in a StyleProtocol instance. By setting font you are also setting its size; by passing size only SwiftRichString attempts to enumerate between the fonts of the attributed string by altering it along with the (optional) unique font attributes you have set.

The result of the code above is:
screen shot 2018-09-03 at 17 01 33

@malcommac malcommac self-assigned this Sep 3, 2018
@malcommac malcommac added the bug label Sep 3, 2018
@malcommac malcommac added this to the 2.0.2 milestone Sep 3, 2018
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