How to use the completion handler in dismissViewControllerAnimated with Swift?
<p>While refactoring an app from Objective-C to Swift I ran into a problem, which I cannot resolve on my own.</p>

<p><code>ViewControllerOne</code> has the method<br>
<code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender</code>. In this method I am setting the <code>destinationViewController</code>:<br>
<code>ViewControllerTwo *viewControllerTwo = [segue destinationViewController];</code><br>
and some block handler like this:</p>

<pre><code>[viewControllerTwo setHandlerOne:^(id sender) {
    [...]
}]
</code></pre>

<p>Then while touching on a button I am showing a modal view.
In the modal view controller <code>ViewControllerTwo</code> I am closing this modal view:</p>

<pre><code>- (IBAction)buttonPressed:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
    self.handlerOne(sender);
}
</code></pre>

<p>In the Swift code I have set up the same:<br>
<code>ViewControllerOne</code> with method:<br>
<code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)</code><br>
Set the <code>destinationViewController</code><br>
<code>let vc = segue.destinationViewController as! ViewControllerTwo</code><br>
And the code block:</p>

<pre><code>vc.setHandlerOne { () -&gt; Void in
    [...]
}
</code></pre>

<p>This way I get the error <code>Value of type 'ViewControllerTwo' has no member 'setHandlerOne'</code>. What am I missing here? Do I have to manually set it in the <code>viewControllerTwo</code>?</p>