title: How to call the typealias in Swift
body: <p>I've just started learning swift 3 and I'm converting this code in objective-c to swift 3 and I'm stuck at <code>typealias</code>. I've searched for it and there may be right help already available but it didn't solved my issue.
  <br><br>This is the line in objective-c:</p>
  
  <pre><code>typedef void (^TagBlock)(NSString *tagText, NSInteger idx);
  </code></pre>
  
  <p>And there is a property for it as <code>@property (nullable, copy) TagBlock tapBlock;</code> in objective-c.<br>Now I've converted the above line as:</p>
  
  <pre><code>typealias TagBlock = (_ tagText: NSString,_ idx: NSInteger) -&gt; Void
  </code></pre>
  
  <p>Which is something I understand very well syntax wise and the property is <code>var tapBlock: TagBlock!</code> in case of swift.<br><br>Now as I try to call it in one of the <code>@IBAction</code> methods as:</p>
  
  <pre><code>if (tapBlock != nil) {
      self.setTapBlock(tapBlock: (tagButton.titleLabel?.text,tag) -&gt; Void)
  }
  </code></pre>
  
  <p>This gives an error as:</p>
  
  <blockquote>
    <p>Expected type before '->'</p>
  </blockquote>
  
  <p>This line in objective is:</p>
  
  <pre><code>if (_tapBlock) {
      _tapBlock(sender.titleLabel.text, self.tag);
    }
  </code></pre>
  
  <p><br><br><strong>UPDATE</strong> After <code>import UIKit</code> I've added <code>typealias TagBlock = ((String, Int) -&gt; Void)?</code> and after that <code>var tapBlock: TagBlock!</code><br>In <code>class TagView: UIView</code> I'm calling in in an <code>@IBAction</code> as </p>
  
  <pre><code>@IBAction func tagTapped(_ sender: Any) {
      if (tapBlock != nil) {
              tapBlock?(sender.titleLabel.text, self.tag)
          }
      }
  </code></pre>
  
  <p>So at <code>tapBlock?(sender.titleLabel.text, self.tag)</code> it give me the error:</p>
  
  <blockquote>
    <p>Cannot call value of non-function type 'TagBlock'`</p>
  </blockquote>