For latest swift versions, Xcode 16 and iOS 18, below solution works.
button.configuration = nil button.titleLabel?.adjustsFontSizeToFitWidth = true
button.configuration = nil
button.titleLabel?.adjustsFontSizeToFitWidth = true