title: Auto Layout: why do conflicting required hugging priorities & fixed-width constraints not throw an exception?
body: <p>I have the following setup:</p>
  
  <ul>
  <li>A custom subclass of UIView that defines a fixed <code>intrinsicContentSize</code> of <code>(50,50)</code></li>
  <li>An instance of this view as the only subview of a new app's window</li>
  <li>Horizontal and vertical centering constraints from the view to the window</li>
  </ul>
  
  <p>As expected, this gives me a view that's 50x50, centered in the app's window. Now, if I both:</p>
  
  <ul>
  <li>Add a required width constraint to the view with a 100pt constant, and</li>
  <li>Set the view's content hugging priority to required along the horizontal axis</li>
  </ul>
  
  <p><strong>...why doesn't the Auto Layout system throw an exception?</strong></p>
  
  <p>I would expect that such a system would require the view to be both 50pts wide (since its intrinsic content width is 50pts and its hugging priority is required) and 100pts wide (since it has a required explicit width constraint at 100pts), and thus be inconsistent. Instead, the view is happily 100pts wide, with (seemingly) no consideration given to its content hugging.</p>
  
  <p>The entire batch of code I use to reproduce this result (in a new Empty Application's app delegate .m file):</p>
  
  <pre><code>@interface TEFixedSizeView : UIView
  @end
  
  @implementation TEFixedSizeView
  
  - (CGSize)intrinsicContentSize;
  {
      return (CGSize){.width = 50.0f, .height = 50.0f};
  }
  
  @end
  
  @implementation TEAppDelegate
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
      self.window.backgroundColor = [UIColor whiteColor];
  
      TEFixedSizeView *view = [[TEFixedSizeView alloc] init];
      view.translatesAutoresizingMaskIntoConstraints = NO;
      view.backgroundColor = [UIColor redColor];
      [self.window addSubview:view];
  
      [self.window addConstraint:[NSLayoutConstraint constraintWithItem:view
                                                              attribute:NSLayoutAttributeCenterX
                                                              relatedBy:NSLayoutRelationEqual
                                                                 toItem:self.window
                                                              attribute:NSLayoutAttributeCenterX
                                                             multiplier:1.0f
                                                               constant:0.0f]];
      [self.window addConstraint:[NSLayoutConstraint constraintWithItem:view
                                                              attribute:NSLayoutAttributeCenterY
                                                              relatedBy:NSLayoutRelationEqual
                                                                 toItem:self.window
                                                              attribute:NSLayoutAttributeCenterY
                                                             multiplier:1.0f
                                                               constant:0.0f]];
  
      [view setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  
      [view addConstraint:[NSLayoutConstraint constraintWithItem:view
                                                       attribute:NSLayoutAttributeWidth
                                                       relatedBy:NSLayoutRelationEqual
                                                          toItem:nil
                                                       attribute:NSLayoutAttributeNotAnAttribute
                                                      multiplier:0.0f
                                                        constant:100.0f]];
  
      [self.window makeKeyAndVisible];
      return YES;
  }
  
  @end
  </code></pre>