[swift-users] Importing NSUInteger in my own Objective-C Code as Int
clattner at apple.com
Sun Jan 17 15:01:58 CST 2016
> On Jan 15, 2016, at 10:19 AM, Jens Alfke via swift-users <swift-users at swift.org> wrote:
>> On Jan 15, 2016, at 5:19 AM, Marco Masser via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>> Swift imports NSUInteger in Objective-C APIs as Int, but only for Frameworks like Foundation and AppKit. For other code, NSUInteger is imported simply as UInt.
> Really? I’d never noticed that. It seems wrong to me, since NSUInteger is clearly an unsigned type, so it should map to Uint.
Yes, it is intentional, we do the same for size_t.
As far as I know, there is no way to get the same behavior for your own code. It would be reasonable to introduce a clang attribute for that though.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users