кнопка Sizetofit не работает Swift

class ResizableButton: UIButton {
    override var intrinsicContentSize: CGSize {
       let imageViewWidth = imageView?.frame.width ?? 0.0
       let labelSize = titleLabel?.sizeThatFits(CGSize(width: frame.width, height: .greatestFiniteMagnitude)) ?? .zero
       let desiredButtonSize = CGSize(width: labelSize.width + titleEdgeInsets.left + titleEdgeInsets.right + imageViewWidth, height: labelSize.height + titleEdgeInsets.top + titleEdgeInsets.bottom)

       return desiredButtonSize
    }
}
Mobile Star