title: ObjC block in swift
body: <p>Can anybody help me to rewrite this code in swift</p>
  
  <pre><code>    [segmentedControl1 setTitleFormatter:^NSAttributedString *(HMSegmentedControl *segmentedControl, NSString *title, NSUInteger index, BOOL selected) {
  NSAttributedString *attString = [[NSAttributedString alloc] initWithString:title attributes:@{NSForegroundColorAttributeName : [UIColor blueColor]}];
  return attString;
  }];
  </code></pre>
  
  <p>Part of HMSegmentedControl class:</p>
  
  <pre><code>    @interface HMSegmentedControl : UIControl
  ....
  @property (nonatomic, copy) HMTitleFormatterBlock titleFormatter;
  ....
  @end
  
  typedef NSAttributedString *(^HMTitleFormatterBlock)(HMSegmentedControl *segmentedControl, NSString *title, NSUInteger index, BOOL selected);
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>segmentedControl1.titleFormatter = {(segmentedControl: HMSegmentedControl, title: NSString, index: Int, selected: Bool) -&gt; NSAttributedString in
  
          }
  </code></pre>
  
  <p>I get an error: "‘(HMSegmentedControl, NSString, Int, Bool)->NSAttributedString’ is not convertible to ‘HMTitleFormatterBlock'"</p>