optonaut / ActiveLabel.swift

UILabel drop-in replacement supporting Hashtags (#), Mentions (@) and URLs (http://) written in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

URL Link selected font

nikeshakya opened this issue · comments

I have customized label to have bold font for url links
It works for the first time, but after the link is clicked, the font attribute just invalidates for link...it changes back to normal font

here is my implementation:

self.configureLinkAttribute =  { (type, attributes, isSelected) in
            var atts = attributes
            switch type {
            case .url:
                if self.underlineLink {
                    atts[NSAttributedString.Key.underlineStyle] = NSUnderlineStyle.thick.rawValue
                }
                if let font = self.linkFont {
                    atts[NSAttributedString.Key.font] = font
                }
                break
            default:
                atts[NSAttributedString.Key.underlineStyle] = 0
                break
            }
            return atts
 }