Autolayout warning "NSLayoutConstraint is being configured with a constant that exceeds internal limits"

I have a subclass of UIScrollView called MyScrollView. There is a subview called contentViewinside MyScrollView. The width constraint is set to be the contentSize of MyScrollView.

private func setupSubviews() {
      contentView = ContentView()
      contentView.backgroundColor = UIColor.blue
      contentView.translatesAutoresizingMaskIntoConstraints = false
      contentView.isUserInteractionEnabled = true
   
      self.addSubview(contentView)
    
      contentView.leadingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true
      contentView.trailingAnchor.constraint(equalTo: self.trailingAnchor).isActive = true
      contentView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
      contentView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
      
      // create contentView's Width and Height constraints
      cvWidthConstraint = contentView.widthAnchor.constraint(equalToConstant: 0.0)
      cvHeightConstraint = contentView.heightAnchor.constraint(equalToConstant: 0.0)
           
    // activate them
      cvWidthConstraint.isActive = true
      cvHeightConstraint.isActive = true

        cvWidthConstraint.constant = myWidthConstant //<--- problem here if myWidthConstant is very high, such as 512000
      cvHeightConstraint.constant = frame.height

      contentView.layoutIfNeeded()
}

The problem is if I set cvWidthConstraint.constant to a very high value such as 521000, I get a warning:

This NSLayoutConstraint is being configured with a constant that exceeds internal limits. A smaller value will be substituted, but this problem should be fixed. Break on BOOL _NSLayoutConstraintNumberExceedsLimit(void) to debug. This will be logged only once. This may break in the future.

I wonder how does one set UIScrollView content size to be very high values?

You could just calculate and set the contentSize manually.

That said the limit should be at least 1 million (it varies by platform for various mathematical reasons).

Autolayout warning "NSLayoutConstraint is being configured with a constant that exceeds internal limits"
 
 
Q