title: How to change UIButton attributed text colour programatically?
body: <p>I have a subclass (KeyButton) of UIButton where I am applying certain styles for the button. The following code adds the attributed text for buttons in the ViewController.</p>
  
  <pre><code>func superScriptText(text: String, button: KeyButton, fontSize: Int) {
      let font:UIFont? = UIFont.systemFont(ofSize: 22, weight: UIFont.Weight.light)
      let fontSuper:UIFont? = UIFont(name: "Helvetica", size:CGFloat(fontSize))
      let attString:NSMutableAttributedString = NSMutableAttributedString(string: text, attributes: [.font:font!])
      attString.setAttributes([.font:fontSuper!,.baselineOffset:15], range: NSRange(location:1,length:1))
      button.setAttributedTitle(attString, for: .normal)
  }
  </code></pre>
  
  <p>How can I change the color of attributed text for the button in the class?</p>