SHARE
TWEET

Atomic properties

a guest Jan 4th, 2014 991 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <Foundation/Foundation.h>
  2.  
  3. @interface Test : NSObject
  4. @property (readwrite, strong) NSMutableArray *atomicArray;
  5. @property (nonatomic, readwrite, strong) NSMutableArray *nonatomicArray;
  6. @end
  7.  
  8. @implementation Test
  9. @end
  10.  
  11. int main() {
  12.     @autoreleasepool {
  13.         Test *t = [[Test alloc] init];
  14.  
  15.         NSMutableArray *a = [[NSMutableArray alloc] init];
  16.         [t setAtomicArray:a];
  17.         [a release];
  18.  
  19.         NSMutableArray *one = [t atomicArray];
  20.         [t setAtomicArray: nil];
  21.         [one addObject:@"Test"];
  22.  
  23.         a = [[NSMutableArray alloc] init];
  24.         [t setNonatomicArray:a];
  25.         [a release];
  26.  
  27.         NSMutableArray *two = [t nonatomicArray];
  28.         [t setNonatomicArray:nil];
  29.         [two addObject:@"Test"];
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top