title: How to use nonnull and nullable Objective-C keywords in block-based API method
body: <p>Consider the following method</p>
  
  <pre><code>- (void)methodWithArg:(NSString *)arg1 andArg:(NSString *)arg2 completionHandler:(void (^)(NSArray *results, NSError *error))completionHandler;
  </code></pre>
  
  <p>With the new <code>nonnull</code> and <code>nullable</code> <a href="https://developer.apple.com/swift/blog/?id=25">annotation keywords</a> we can enrich it as follows:</p>
  
  <pre><code>- (void)methodWithArg:(nonnull NSString *)arg1 andArg:(nullable NSString *)arg2 completionHandler:(void (^)(NSArray *results, NSError *error))completionHandler;
  </code></pre>
  
  <p>but we also get this warning:</p>
  
  <blockquote>
    <p>Pointer is missing a nullability type specifier (__nonnull or
    __nullable)</p>
  </blockquote>
  
  <p>It refers to the third parameter (the block one).</p>
  
  <p>The <a href="https://developer.apple.com/swift/blog/?id=25">documentation</a> doesn't cover with examples how to specify the nullability of block parameters. It states verbatim </p>
  
  <blockquote>
    <p>You can use the non-underscored forms nullable and nonnull immediately
    after an open parenthesis, as long as the type is a simple object or
    block pointer.</p>
  </blockquote>
  
  <p>I tried putting one of the two keywords for the block (in any position) without any luck. Also tried the underscore prefixed variants (<code>__nonnull</code> and <code>__nullable</code>).</p>
  
  <p>Therefore my question is: how can I specify the nullability semantic for block parameters?</p>