I have tried this but it didn\'t work, the text is out of the button boundaries.
button.titleLabel!.adjustsFontSizeToFitWidth = true
button.titleLabel!.numberOfL
You can try this:
1.define the title size based on the current font size of your button
let nsTitle = NSString(string:"yourButtonTitle")
let font = button.titleLabel?.font
let titleSize = nsTitle.sizeWithAttributes([NSFontAttributeName:font])
2.check whether your title fits the button title label :
if titleSize.width > button.titleLabel?.bounds.width{
//set the appropriate font size
}else{
//set the appropriate font size or do nothing
}