title: Swift: How to declare view descendants
body: <p>I'm trying to add the following constraint to align an image within a table cell. self refers to the UITableViewCell object within which the image view will reside:</p>
  
  <pre><code>    var imageViewTest = UIImageView();
  
      self.rowImageView = imageViewTest;
  
      var xAlignmentConstraint = NSLayoutConstraint(
          item: imageViewTest,
          attribute: NSLayoutAttribute.CenterX,
          relatedBy: NSLayoutRelation.Equal,
          toItem: self,
          attribute: NSLayoutAttribute.CenterX,
          multiplier: 1,
          constant: 137
      );
  
  
  NSLayoutConstraint.activateConstraints([xAlignmentConstraint]);
  
  self.addConstraint(xAlignmentConstraint);
  </code></pre>
  
  <p>When running the code, I get the following error:</p>
  
  <blockquote>
    <p>Unable to activate constraint with items because they have no common
    ancestor.  Does the constraint reference items in different view
    hierarchies?  That's illegal.</p>
  </blockquote>
  
  <p>How do I declare imageViewTest to be a descendant of self?</p>