I have a problem configuring my UIButton with the new iOS 15 UIButton.Configuration.plain(). I want my button to be sized according to the title label's text using this code:
var configuration = UIButton.Configuration.plain()
configuration.title = title
configuration.titlePadding = 0
configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)   
loginButton.configuration = configuration
loginButton.frame = CGRect(x: 0, y: 0, width: 20, height: 14)
loginButton.titleLabel?.font = UIFont(name: "Roboto-Medium", size: 14)
When the app is running on the simulator, the design looks fine but when I tap on the button, the font becomes larger and the font family that I've specified isn't being used as well. The button stays in this configuration state all the way
The same thing occurred when I navigated to another View controller.