Skip to content

Instantly share code, notes, and snippets.

gist 2
$ defaults write com.apple.finder AppleShowAllFiles -bool true
NSURL *documentsDirectoryURL = [NSURL fileURLWithPath:
[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]];
NSLog(@"%@",documentsDirectoryURL);
@interface ViewController: UIViewController {
UIView *_demoView;
BOOL _gameCenterAvailable;
}
dispatch_group_t groupName = dispatch_group_create();
dispatch_group_enter(groupName);
dispatch_group_leave(groupName);
dispatch_group_notify(groupName, dispatch_get_main_queue(), ^(void){})
var dates: [NSDate]
var words: Set<String>
var cachedData: [NSURL: NSData]
@property (nonatomic, readonly, copy) NSArray<__kindof NSURL* > *urlArray;
NSURL *getOneURL = self.urlArray.lastObject;
@property (copy, readonly) NSArray * _Nonnull allItems;
@property (nonatomic, strong, nonnull) Person *personNameA;
@property (nonatomic, copy, readonly, nullable) NSString *personName;
+ (nullable NSString *)sayHello:(nonnull NSString *)message;
- (AAPLListItem * _Nullable)itemWithName:(NSString * _Nonnull)name;
- (void)takesNullableParameter:(nullable id)value;
class Person {
var residence: Residence? //Optional default nil value
}
class Residence {
var numberOfRooms = 1
}
let jay = Person() //jay has a residence property value nil
//runtime error, can't send message to nil
let roomCount = john.residence!.numberOfRooms //unwrap optional
@property (nonatomic, strong) NSArray <NSURL *> *demoArray;
- (void)demoMethod {
NSURL *url1 = [NSURL URLWithString:@"http:www.urldemo1.com"];
NSURL *url2 = [NSURL URLWithString:@"http:www.urldemo2.com"];
self.demoArray = @[url1, url2];
}