title: Supplying NSMutableArray type to Objective C function in Swift
body: <p>I have a library function written in Objective C that has takes a pointer to a NSMutableArray. However, when I try to call it with a Swift array I get this error:</p>
  
  <pre><code>DiscoverViewController.swift:34:20: Could not find an overload for 'init' that
  accepts the supplied arguments
  </code></pre>
  
  <p>However, if I pass <code>nil</code>, it works. That makes sense.</p>
  
  <p>Here is an example of the Objective-C:</p>
  
  <pre><code>int ex:(NSMutableArray *)in { return in.count; }
  </code></pre>
  
  <p>And an example of the Swift:</p>
  
  <pre><code>ex([1,2,3,4]) // doesn't compile
  
  ex(nil) // does compile
  </code></pre>
  
  <p>What do I have to do to convert/cast the Swift array to the NSMutableArray type that my library function is looking for?</p>
  
  <p>Here is the full method signature in case my example is too simplified:</p>
  
  <pre><code>- (id) initWithTitle: (NSString *) title place: (PublicPlaceInfo *) place
  datetimeInterval: (DateTimeInterval *) datetimeInterval costBracket: (int)
  costBracket creatorId: (PersonID) creatorId cover: (Url) cover experienceId: 
  (ExperienceID) experienceId numJoined: (int32_t) numJoined relatedJoined: 
  (NSMutableArray *) relatedJoined;
  </code></pre>
  
  <p>And then I know it is failing at the relatedJoined section because I converted all other potentially anonymous instantiations to variables. I have to say, this is certainly not the most helpful compile error..</p>