Skip to content

Attributed string attributes not preserved #67

Open
@andreaslindahl

Description

@andreaslindahl

When setting the attributedText property to an NSAttributedString, NantesLabel sets the text property of the label to attributedText.string instead of actually setting the attributedText property, which means that any formatting, and other attributes, set on the NSAttributedString aren't used.

Is it possible to use an NSAttributedString without losing all of the formatting and attributes?

override open var attributedText: NSAttributedString? {
    get {
        return _attributedText
    } set {
        guard newValue != _attributedText else {
            return
        }

        _attributedText = newValue
        setNeedsFramesetter()
        _accessibilityElements = nil
        linkModels = []

        checkText()

        setNeedsDisplay()
        invalidateIntrinsicContentSize()

        super.text = attributedText?.string
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions