In my swift app, I really need to store a UInt32 value and retrieve it using NSCoder. The issue is, there are methods for signed integers :
coder.decodeInteger()
coder.decodeInt32()
coder.decodeInt64()
but not for unsigned integers. Also, casting an Int32 of negative value in an UInt32 does not seem to work.
Am I missing some point?
The tool you want is
init(bitPattern:). This is the same as C-style casting on integers (which is how you use these methods in ObjC when you need unsigned ints). It just reinterprets the bits.