How one can change constraints of UIBarButtonItem?


I’ve a customized navigation bar with the superclass UINavigationBar with a customized navigation controller with the superclass UINavigationController. I added a button to the left aspect of my navigation bar. I additionally modified the navigation bar peak and altered the button dimension in UIBarButtonItem. I take advantage of this code to do that:

class CustomNavigationViewController: UINavigationController {
    override func viewDidLoad() {
        // change peak

        let customNavigationBar = CustomNavigationBar(body: CGRect(x: 0, y: 0, width: UIScreen.fundamental.bounds.width, peak: 68))
        // change button dimension

        let customButton = UIButton.init(body: CGRect.init(x: 0, y: 0, width: 44, peak: 44))
        customButton.setImage(UIImage.init(named:"iOS2"), for: .regular)
        let customNavigationItem = UINavigationItem()
        customNavigationItem = UIBarButtonItem.init(customView: customButton)
        customNavigationBar.gadgets = [customNavigationItem]

class SLNavigationBar: UINavigationBar { 

    override init(body: CGRect) {
        tremendous.init(body: body)
    required init?(coder: NSCoder) {
        tremendous.init(coder: coder)
    non-public func commonInit() {
        backgroundColor = .white


I get this consequence. On this case, the button high constraint = 0:

enter image description here

However I wish to get this consequence (be aware the place of the inexperienced sq.), with button high constraint = 12:

enter image description here

How one can change high UIBarButtonItem constraint?