0

I am making a script to allow users to change element colors.

The script is designed to work on the text in buttons.

I have tried this:

func prettyText(_ button: RoundButton, colour: UIColor) {

   button.textColor = colour

}

but it gives this error:

Value of type 'RoundButton' has no member 'textColor'; did you mean 'tintColor'?

AlexSmet
  • 2,141
  • 1
  • 13
  • 18
Parsa Yazdani
  • 164
  • 1
  • 11
  • 1
    Possible duplicate of [How to set the title text color of UIButton?](https://stackoverflow.com/questions/31088172/how-to-set-the-title-text-color-of-uibutton) – Larme Oct 19 '18 at 07:55

1 Answers1

2

UIButton has setTitleColor(_:for:) method. So in your case

func prettyText(_ button: RoundButton, colour: UIColor) {
    button.setTitleColor(colour, for: .normal)
}
Peter Tretyakov
  • 3,380
  • 6
  • 38
  • 54