Closed vatsal1992 closed 6 years ago
You can use any underline style from https://developer.apple.com/documentation/appkit/nsunderlinestyle
so you could say .underline(.patternDot)
actually,
i've downloaded latest example and gave a try .underline(.patternDot)
but this doesn't seems working . that's why i raised an issue.
but anyway thanks for immediate response. 👍
You where right. If you want a pattern, then the values need to do an or with the style.
I tried this by adding this code to the attributer:
open func underline(raw: Int) -> Attributer {
return applyAttributes(NSAttributedStringKey.underlineStyle.rawValue, value: NSNumber(value: raw))
}
And then calling it like this:
.append("Tap on ").black.underline(raw: (NSUnderlineStyle.patternDash.rawValue | NSUnderlineStyle.styleSingle.rawValue))`
But I do want a cleaner call to the underline function. I think I will add an underline function with 2 parameters (one for the style and one for the pattern)
Ok, that works. When I add this:
open func underline(_ style: NSUnderlineStyle, _ pattern: NSUnderlineStyle) -> Attributer {
return applyAttributes(NSAttributedStringKey.underlineStyle.rawValue, value: NSNumber(value: (style.rawValue | pattern.rawValue)))
}
it can be called with:
.append("Tap on ").black.underline(.styleDouble, .patternDashDotDot)
I will push that code later today to GitHub
its pushed as version 0.7.0
If you have any other issues, then just let me know.
Hello there, This is i tried,