Adjust UIButton font size to width
Try this:
button.titleLabel?.numberOfLines = 1
button.titleLabel?.adjustsFontSizeToFitWidth = true
button.titleLabel?.lineBreakMode = .byClipping //<-- MAGIC LINE
I'm not sure why this does the trick but it does :)
button.titleLabel.adjustsFontSizeToFitWidth = YES;
should do the work on its own if you are using Auto-Layout and have set a constraint on the button's width.
The other options (minimum scale factor, number of lines etc) can still be used to customize further according to your needs, but are not required.