Skip to content

Instantly share code, notes, and snippets.

@EvgenyKarkan
EvgenyKarkan / gist:9517024
Created March 12, 2014 21:43
Xcode 5.1 issue with unused variable.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
if (touch != nil) {
[self.hero flyWithYLimit:self.size.height];
}
}
}
@EvgenyKarkan
EvgenyKarkan / gist:9e4f2b2890fe062c5273
Last active August 29, 2015 14:03
Enumerate Objects Using Block
- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block {
NSParameterAssert(block != NULL);
NSUInteger idx = 0;
for(id obj in self) {
BOOL stop = NO;
block(obj, idx++, &stop);
@EvgenyKarkan
EvgenyKarkan / gist:c8cac8ceaacf3272759e
Last active August 29, 2015 14:10
RunKeeper URL scheme
-(void) openReceiverApp
{
UIApplication *ourApplication = [UIApplication sharedApplication];
NSString *ourPath = @"RunKeeperPro://";
NSURL *ourURL = [NSURL URLWithString:ourPath];
if ([ourApplication canOpenURL:ourURL]) {
[ourApplication openURL:ourURL];
}
// Case 1
// A modifiable pointer to a constant NSString.
//
NSString* john = @"John";
NSString* const userName1 = john;
//If we try like below - an error occurs because userName1 is a modifiable pointer to a constant NSString, so its value can't be modified
//userName1 = @"Not John"; // Invalid -> Read-only variable is not assignable
#pragma mark Singleton stuff
static id _sharedInstance;
+ (EKCoreDataProvider *)sharedInstance
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedInstance = [[EKCoreDataProvider alloc] init];
});
@EvgenyKarkan
EvgenyKarkan / ObjC-conventions.md
Last active January 4, 2016 00:08
ObjC conventions

Space vs Tab

Space

- (NSData *)returnSomething 
{
    // uses 4 spaces for indentation
    return data;
}
@EvgenyKarkan
EvgenyKarkan / ios-questions-interview.md
Created October 1, 2015 08:41 — forked from arturlector/ios-questions-interview.md
Вопросы на собеседование iOS разработчика.

Вопросы на собеседование iOS разработчика (дополненное издание):

General:

  • Что такое полиморфизм?

  • Что такое *инкапсуляция? Что такое *нарушение инкапсуляции?

  • Чем абстрактный класс отличается от интерфейса?

  • Расскажите о паттерне MVC. Чем отличается пассивная модель от активной?