-
Notifications
You must be signed in to change notification settings - Fork 4
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
Added factory functions for creating TextStyles based off existing values #18
Conversation
…kdown_tag Markdown tag for underline (==)
XCTAssertEqual(capitalized, capitalized) | ||
} | ||
|
||
func testTextStyle_isNotEqual_whenCustom() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kinda weird and I don't think there is really a good way to test equality for functions. Can you leave a comment noting this in the file where you are doing Equatable
conformation?
/// - Parameter color: Underline color. Defaults to textColor. | ||
/// - Parameter style: Underline style. Defaults to single line. | ||
/// - Returns: New TextStyle with underline. | ||
public func underlined(color: UIColor? = nil, style: NSUnderlineStyle = .styleSingle) -> TextStyle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should create individual functions for bold
, italic
and underlined
... It might lead us down to a rabbit hole that we might not necessarily wanna go down.
let strikethroughColorToUse = (newStrikethroughColor == nil) ? self.strikethroughColor : newStrikethroughColor! | ||
let underlineStyleToUse = (newUnderlineStyle == nil) ? self.underlineStyle : newUnderlineStyle! | ||
let underlineColorToUse = (newUnderlineColor == nil) ? self.underlineColor : newUnderlineColor! | ||
let textTransformToUse = (newTextTransform == nil) ? self.textTransform : newTextTransform! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would using ??
operator make these slightly nicer to read?
Closing this and reopening a new PR based on the latest master changes in #21... |
TextStyle
s based on existing values (e.g.textStyle.with(newTextColor:)
TextStyle
with new font sizeTextStyle
with bold/italic as fontTextStyle
andTextTransform
to beEquatable