Xcode UI Tests can't find views that are added programmatically
<p>I'm adding a child view to my view programmatically, and when I do I attach all accessibility params to it:</p>

<pre><code>  [labelView setAccessibilityLabel:@"label"];
  [labelView setIsAccessibilityElement:YES];
  [labelView setUserInteractionEnabled:YES];
</code></pre>

<p>But when I query the UI like this:</p>

<pre><code> let app = XCUIApplication()
 app.staticTexts["label"]
</code></pre>

<p>The test fails because it couldn't find the view.</p>

<p>How do I deal with this, how to make dynamically added views available for UI Testing?</p>