Based on your edit to the question a little investigation is in order...
It looks like NSUUID
behaves like a class cluster and you cannot sub-class it without implementing it's key methods and providing the functionality of UUID generation yourself. If you do sub-class it you get a parent class whose UUIDString
is the empty string. While a standard init
of the class gives you back an instance of __NSConcreteUUID
whose UUIDString
is more useful!
If the above is confusing the following partial implementation shows one way to do this:
@interface LowerUUID : NSUUID
@end
@implementation LowerUUID
{
NSUUID *real;
}
- (id) init
{
self = [super init];
if (self)
real = NSUUID.new;
return self;
}
- (NSString *) UUIDString
{
NSString *original = [real UUIDString];
NSString *lower = original.lowercaseString;
return lower;
}
@end
To be complete you also need to provide implementations of the other methods.
For this particular class it is unlikely you'll find this worth it, but for class clusters like NSMutableArray
it does make sense.
You could submit a bug report to Apple stating the documentation does not state you cannot trivially sub-class NSUUID
.