title: NSUInteger and NSInteger bridging to Swift
body: <p>With Swift 1.2 (yes, I've not switched over to Xcode 7, which is causing me grief), I have the following table view delegate method:</p>
  
  <pre><code>func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return self.coreDataSource.numberOfRowsInSection(section)
  }
  </code></pre>
  
  <p>which causes Xcode 6.4 to give the error:</p>
  
  <blockquote>
    <p>Cannot invoke 'numberOfRowsInSection' with an argument list of type
    '(Int)'</p>
  </blockquote>
  
  <p>My CoreDataSource method, bridged from Objective-C, has the following .h declaration:</p>
  
  <pre><code>- (NSUInteger) numberOfRowsInSection: (NSUInteger) section;
  </code></pre>
  
  <p>If I apply a UInt coercion in my table view delegate method:</p>
  
  <pre><code>func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return self.coreDataSource.numberOfRowsInSection(UInt(section))
  }
  </code></pre>
  
  <p>Xcode now gives the error:</p>
  
  <blockquote>
    <p>'UInt' is not convertible to 'Int'</p>
  </blockquote>
  
  <p>So, it looks to be damed if you do, damed if you don't kind of scenario. </p>
  
  <p>From <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/WorkingWithCocoaDataTypes.html" rel="nofollow">Apple's docs</a>, they say:</p>
  
  <blockquote>
    <p>Swift bridges NSUInteger and NSInteger to Int.</p>
  </blockquote>
  
  <p>Thoughts?</p>