Swift - set UIButton title regardless of state

setTitle now takes an OptionSet - so you need to pass in an empty set.

Syntax is now:

button.setTitle("Button Text", for: [])

There isn't a method to set the title for all states at once, however if you never set the title for states other than the normal state, the unset states will default to the normal title.

From the docs

If a title is not specified for a state, the default behavior is to use the title associated with the UIControlStateNormal state. If the value for UIControlStateNormal is not set, then the property defaults to a system value.

So just call

button.setTitle("Button text", for:.normal)

Without setting the title for other states. If you need to set different titles for the other states, you'll need to set them back every time you change the button's title.