You should use setTitle
method to set button title for states.
button.setTitle("Your button title here", for: .normal)
setValue(_:forKeyPath:) is a method from NSObject
class which UIButton
is a subclass of. It is not recommended to use KVO. Read this thread for more information.
5
solved UIButton set titleLabel setValue(newLabel, forKeyPath: “titleLabel”)