Unable to simultaneously satisfy constraints when UIToolbarContentView is present

In my case this was resolved by specifying a valid frame when instantiating the UIToolbar.
UIToolbar(frame: ..) instead of just UIToolbar()

For example:

UIToolbar(frame: CGRect(origin: CGPoint.zero, size: CGSize(width: _viewSizeWidth, height: CGFloat(44))))

where _viewSizeWidth was calculated elsewhere based on the window size.


Swift 5.2

The constraint error seems to occur when the width of the UIToolbar is set to the width of the screen. The height seems to be irrelevant.

I have silenced the warning by setting a width wide enough to accept the UIBarButtonItem(s). Making the width too small also invokes the error.

let toolBar = UIToolbar(frame: CGRect(origin: .zero, size: CGSize(width: 100, height: 44.0)))