I have a framework I wrote that maps Objective C objects to sqlite records - 
deriving sqlite schema definitions from property definitions.  You simply 
derive model classes from my base class Model and the base class will 
introspect the properties and handle all the sql for you.  A little like 
CoreData but the property definitions are used for the meta model instead of an 
external model file and it is a lot leaner and natural feeling.

I picked NSUInteger for the auto incremented primary key because, after all, it 
would never go negative.

However, when I tried to import this framework into Swift and use Model as a 
base class for a Swift class, I found it nearly impossible to satisfy the 
compiler about mixed mode comparisons and ultimately changed the type to 
NSInteger.  

I was not happy about it and if I wasn't the framework author I would have 
thought harder about changing it.



> On Feb 1, 2017, at 17:29, Jordan Rose via swift-evolution 
> <[email protected]> wrote:
> 
> find out how Objective-C projects are using NSUInteger in their headers:
> 
> - Do they have no NSUIntegers at all?
> - Are they using NSUInteger because they’re overriding something that used 
> NSUInteger, or implementing a protocol method that used NSUInteger?
> - Are they using NSUInteger as an opaque value, where comparisons and 
> arithmetic are uninteresting?
> - Are they using NSUInteger as an index or count of something held in memory?

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to