Skip to content

Instantly share code, notes, and snippets.

@Raztor0
Last active January 14, 2017 03:18
Show Gist options
  • Save Raztor0/7c7492316ddb32e09d143ec2b9c320d0 to your computer and use it in GitHub Desktop.
Save Raztor0/7c7492316ddb32e09d143ec2b9c320d0 to your computer and use it in GitHub Desktop.
@interface SomeClass : NSObject
@property (nonatomic, strong) NSString *someProperty;
@end
@implementation SomeClass
+ (void)load {
[self new];
}
- (instancetype)init {
self = [super init];
if (self) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul), ^{
NSLog(@"%@", [NSThread currentThread]);
while (true) {
@autoreleasepool {
self.someProperty = [[NSProcessInfo processInfo] globallyUniqueString];
}
}
});
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul), ^{
NSLog(@"%@", [NSThread currentThread]);
while (true) {
@autoreleasepool {
NSString __unused *something = [self getPropertyOrHoopla];
}
}
});
}
return self;
}
- (NSString *)getPropertyOrHoopla {
return self.someProperty ?: @"hoopla";
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment