RichString
public protocol RichStringThe RichString protocol defines the interface of this framework.
Note
All attributes are always applied on the entire range of the attributed string. This means that you normally create attributed strings for the text parts that have the desired attributes, and then concatenate them (using operator+(_:_:) for example).
- 
                  
                  Applies the given font size. If no font was set on the attributed string yet, Font.systemFontwill be assumed.DeclarationSwift func fontSize(_ size: CGFloat) -> NSAttributedStringParameterssizeThe desired point size of the attributed string. Return ValueA new attributed string that has the given font size attribute. 
- 
                  
                  Applies the given font size. If no font was set on the attributed string yet, Font.systemFontwill be assumed.
- 
                  
                  Applies the given paragraph style. DeclarationSwift func paragraphStyle(_ paragraphStyle: NSParagraphStyle) -> NSAttributedStringParametersparagraphStyleThe paragraph style that is applied. Return ValueA new attributed string that has the paragraph style applied. 
- 
                  
                  Applies a paragraph style, configuring it with the given closure. If the attributed string already had a paragraph style attribute, the configureclosure is called on that paragraph style; otherwise a newNSMutableParagraphStyleis used.For example: let result = "Hello World".paragraphStyle { $0.firstLineHeadIndent = 10 }DeclarationSwift func paragraphStyle(configure: (NSMutableParagraphStyle) -> Void) -> NSAttributedStringParametersconfigureThe closure that you can use to configure the paragraph style. Return ValueA new attributed string that has the configured paragraph style applied. 
- 
                  
                  Applies the given (foreground) color. DeclarationSwift func color(_ color: Color) -> NSAttributedStringParameterscolorThe foreground color that is applied. Return ValueA new attributed string that has the given foreground color. 
- 
                  
                  Applies the given background color. DeclarationSwift func backgroundColor(_ color: Color) -> NSAttributedStringParameterscolorthe background color that is applied Return Valuea new attributed string that has the given background color. 
- 
                  
                  Configures whether or not to use ligatures. Default is that they are used. DeclarationSwift func ligature(_ ligature: Bool) -> NSAttributedStringParametersligatureIndicates whether or not ligatures should be used. Return ValueA new attributed string that has the given ligature attribute. 
- 
                  
                  Configures the amount with which to modify the default kerning. The default 0means that no kerning change is applied.DeclarationSwift func kern(_ kern: Float) -> NSAttributedStringParameterskernThe amount to modify the default kerning. 0means kerning is disabled.Return ValueA new attributed string that has the given kerning applied. 
- 
                  
                  Configures the strike through style. DeclarationSwift func strikeThrough(style: NSUnderlineStyle) -> NSAttributedStringParametersstyleThe NSUnderlineStyleto apply. Please note that depending on OS and version not all styles may actually work.Return ValueA new attributed string that has the given strike through style applied. 
- 
                  
                  Configures the strike through color. DeclarationSwift func strikeThrough(color: Color) -> NSAttributedStringParameterscolorThe color to apply. Please note that only setting the color has no effect, the style must be configured as well. Return ValueA new attributed string that has the given strike through color applied. 
- 
                  
                  Configures both the strike through color and style. DeclarationSwift func strikeThrough(color: Color, style: NSUnderlineStyle) -> NSAttributedStringParameterscolorThe color to apply. styleThe NSUnderlineStyleto apply. Please note that depending on OS and version not all styles may actually work.Return ValueA new attributed string that has the given strike through color and style applied. 
- 
                  
                  Configures the underline style. DeclarationSwift func underline(style: NSUnderlineStyle) -> NSAttributedStringParametersstyleThe NSUnderlineStyleto apply. Please note that depending on OS and version not all styles may actually work.Return ValueA new attributed string that has the given underline style applied. 
- 
                  
                  Configures the underline color. DeclarationSwift func underline(color: Color) -> NSAttributedStringParameterscolorThe color to apply. Please note that only setting the color has no effect, the style must be configured as well. Return ValueA new attributed string that has the given underline color applied. 
- 
                  
                  Configures both the underline color and style. DeclarationSwift func underline(color: Color, style: NSUnderlineStyle) -> NSAttributedStringParameterscolorThe color to apply. styleThe NSUnderlineStyleto apply. Please note that depending on OS and version not all styles may actually work.Return ValueA new attributed string that has the given underline color and style applied. 
- 
                  
                  Configures the stroke. DeclarationSwift func stroke(width: Float, color: Color) -> NSAttributedStringParameterswidthThe width of the stroke. colorThe color of the stroke. Return ValueA new attributed string that has the given stroke attributes applied. 
- 
                  
                  Configures the shadow by setting an NSShadowinstance.DeclarationSwift func shadow(_ shadow: NSShadow) -> NSAttributedStringParametersshadowThe NSShadowto apply.Return ValueA new attributed string that has the given shadow applied. 
- 
                  
                  Configures the shadow using a closure that receives an NSShadowinstance.For example: let result = "Hello World".shadow { $0.shadowOffset = CGSize(width: 3, height: 3) $0.shadowBlurRadius = 2 $0.shadowColor = Color.gray }DeclarationSwift func shadow(configure: (NSShadow) -> Void) -> NSAttributedStringParametersconfigureThe closure that you use to configure the shadow; it is passed an NSShadowinstance that you can change and is then applied.Return ValueA new attributed string that has the configured shadow applied. 
- 
                  
                  Creates a new NSTextAttachmentand passes it to theconfigureclosure.DeclarationSwift func attachment(configure: (NSTextAttachment) -> Void) -> NSAttributedStringParametersconfigurethe closure that you can use to configure the NSTextAttachmentinstance.Return ValueA new attributed string that has the configured text attachment. 
- 
                  
                  Adds the “letter pressed” text effect. DeclarationSwift func letterPressed() -> NSAttributedStringReturn ValueA new attributed string that has the “letter pressed” text effect applied. 
- 
                  
                  Creates hyperlink to the given URL with the receiver as text. DeclarationSwift func link(url: NSURL) -> NSAttributedStringParametersurlThe URL to which the hyperlink points. Return ValueA new attributed string that is the receiver converted to a hyperlink. 
- 
                  
                  Creates hyperlink to the given URL with the receiver as text. DeclarationSwift func link(string: String) -> NSAttributedStringParametersstringThe URL string to which the hyperlink points. Return ValueA new attributed string that is the receiver converted to a hyperlink. 
- 
                  
                  Configures the baseline offset. DeclarationSwift func baselineOffset(_ offset: Float) -> NSAttributedStringParametersoffsetThe number of points the text is offset from the baseline. Return ValueA new attributed string that has the given baseline offset configured. 
- 
                  
                  Configures the skew to be applied to glyphs. DeclarationSwift func obliqueness(_ obliqueness: Float) -> NSAttributedStringParametersobliquenessThe skew that is applied to glyphs; 0means no skew.Return ValueA new attributed string that has the given obliqueness configured. 
- 
                  
                  Configures the expansion to be applied to glyphs. DeclarationSwift func expansion(_ expansion: Float) -> NSAttributedStringParametersexpansionThe log of the expansion factor to be applied to glyphs. Return ValueA new attributed string that has the given expansion configured. 
- 
                  
                  Applies the given font size. If no font was set on the attributed string yet, Font.systemFontwill be assumed.DeclarationSwift func fontSize(_ size: CGFloat) -> NSAttributedString?ParameterssizeThe desired point size of the attributed string. Return ValueA new attributed string that has the given font size attribute. 
- 
                  
                  Applies the given (foreground) color. DeclarationSwift func color(_ color: Color) -> NSAttributedStringParameterscolorThe foreground color that is applied. Return ValueA new attributed string that has the given foreground color. 
- 
                  
                  Applies the given background color. DeclarationSwift func backgroundColor(_ color: Color) -> NSAttributedStringParameterscolorthe background color that is applied Return Valuea new attributed string that has the given background color. 
- 
                  
                  Configures the strike through color. DeclarationSwift func strikeThrough(color: Color) -> NSAttributedStringParameterscolorThe color to apply. Please note that only setting the color has no effect, the style must be configured as well. Return ValueA new attributed string that has the given strike through color applied. 
- 
                  
                  Configures both the strike through color and style. DeclarationSwift func strikeThrough(color: Color, style: NSUnderlineStyle) -> NSAttributedStringParameterscolorThe color to apply. styleThe NSUnderlineStyleto apply. Please note that depending on OS and version not all styles may actually work.Return ValueA new attributed string that has the given strike through color and style applied. 
- 
                  
                  Configures the underline color. DeclarationSwift func underline(color: Color) -> NSAttributedStringParameterscolorThe color to apply. Please note that only setting the color has no effect, the style must be configured as well. Return ValueA new attributed string that has the given underline color applied. 
- 
                  
                  Configures both the underline color and style. DeclarationSwift func underline(color: Color, style: NSUnderlineStyle) -> NSAttributedStringParameterscolorThe color to apply. styleThe NSUnderlineStyleto apply. Please note that depending on OS and version not all styles may actually work.Return ValueA new attributed string that has the given underline color and style applied. 
- 
                  
                  Configures the stroke. DeclarationSwift func stroke(width: Float, color: Color) -> NSAttributedStringParameterswidthThe width of the stroke. colorThe color of the stroke. Return ValueA new attributed string that has the given stroke attributes applied. 
- 
                  
                  Configures the shadow by setting an NSShadowinstance.
- 
                  
                  Configures the shadow using a closure that receives an NSShadowinstance.For example: let result = "Hello World".shadow { $0.shadowOffset = CGSize(width: 3, height: 3) $0.shadowBlurRadius = 2 $0.shadowColor = Color.gray }
- 
                  
                  Creates a new NSTextAttachmentand passes it to theconfigureclosure.
 View on GitHub
View on GitHub RichString Protocol Reference
        RichString Protocol Reference