Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Category to generate UUID strings.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// NSString+PKUUID.h | ||
// PKToolbox | ||
// | ||
// Created by Pavel Kunc on 21/05/2012. | ||
// Copyright (c) 2012 Fry-it, Limited. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface NSString (PKUUID) | ||
|
||
+ (NSString *)pk_UUID; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// NSString+PKUUID.m | ||
// PKToolbox | ||
// | ||
// Created by Pavel Kunc on 21/05/2012. | ||
// Copyright (c) 2012 Fry-it, Limited. All rights reserved. | ||
// | ||
|
||
#import "NSString+PKUUID.h" | ||
|
||
@implementation NSString (PKUUID) | ||
|
||
+ (NSString *)pk_UUID { | ||
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); | ||
NSString *str = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); | ||
CFRelease(uuid); | ||
[str autorelease]; | ||
return str; | ||
} | ||
|
||
@end |