This is a quick 5 compatible answer. If you want to use one of the built-in colors, then you can simply use
button.setTitleColor(.red, for: .normal)
If you need some custom colors, then create an extension for UIColor, as shown below.
import UIKit extension UIColor { static var themeMoreButton = UIColor.init(red: 53/255, green: 150/255, blue: 36/255, alpha: 1) }
Then use it for your button as shown below.
button.setTitleColor(UIColor.themeMoreButton, for: .normal)
Hint: You can use this method to store custom colors from the rgba color code and reuse them in the application.
Jay Mayu Apr 05 '19 at 4:25 2019-04-05 04:25
source share