             let lineTextWithAddedLink = NSMutableAttributedString(attributedString: lineTextWithLastWordRemoved)
             if let ellipsis = self.ellipsis {
                 lineTextWithAddedLink.append(ellipsis)
-                lineTextWithAddedLink.append(NSAttributedString(string: " ", attributes: [NSFontAttributeName: self.font]))
+                lineTextWithAddedLink.append(NSAttributedString(string: " ", attributes: [NSAttributedStringKey.font: self.font]))
             }
             lineTextWithAddedLink.append(linkName)
             let fits = self.textFitsWidth(lineTextWithAddedLink)

        }
    }

//    open override var attributedText: NSAttributedString? {
//        set(attributedText) {
//            if let attributedText = attributedText?.copyWithAddedFontAttribute(font), attributedText.length > 0 {
//                super.attributedText = getCollapsedText(for: attributedText, link: collapsedAttributedLink!)
//            }
//            else {
//                super.attributedText = nil
//            }
//        }
//        get {
//            return super.attributedText
//        }
//    }

    fileprivate func findLineWithWords(lastLine: CTLine, text: NSAttributedString, lines: [CTLine]) -> LineIndexTuple {
        var lastLineRef = lastLine

private extension NSAttributedString {
    func hasFontAttribute() -> Bool {
        guard !self.string.isEmpty else { return false }
        let font = self.attribute(NSAttributedStringKey.font, at: 0, effectiveRange: nil) as? UIFont
        return font != nil
    }

    func copyWithAddedFontAttribute(_ font: UIFont) -> NSAttributedString {
        if !hasFontAttribute() {
            let copy = NSMutableAttributedString(attributedString: self)
            copy.addAttribute(NSAttributedStringKey.font, value: font, range: NSRange(location: 0, length: copy.length))
            return copy
        }
        return self.copy() as! NSAttributedString
