Skip to content

Instantly share code, notes, and snippets.

Evgeny Karkan EvgenyKarkan

Block or report user

Report or block EvgenyKarkan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Working with 'const' keyword
// 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
@EvgenyKarkan
EvgenyKarkan / ios-questions-interview.md
Created Oct 1, 2015 — forked from stoicist/ios-questions-interview.md
Вопросы на собеседование iOS разработчика.
View ios-questions-interview.md

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

General:

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

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

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

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

View gist:c8cac8ceaacf3272759e
-(void) openReceiverApp
{
UIApplication *ourApplication = [UIApplication sharedApplication];
NSString *ourPath = @"RunKeeperPro://";
NSURL *ourURL = [NSURL URLWithString:ourPath];
if ([ourApplication canOpenURL:ourURL]) {
[ourApplication openURL:ourURL];
}
@EvgenyKarkan
EvgenyKarkan / gist:9e4f2b2890fe062c5273
Last active Aug 29, 2015
Enumerate Objects Using Block
View gist:9e4f2b2890fe062c5273
- (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:9517024
Created Mar 12, 2014
Xcode 5.1 issue with unused variable.
View gist:9517024
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
if (touch != nil) {
[self.hero flyWithYLimit:self.size.height];
}
}
}
View ObjC-conventions.md

Space vs Tab

Space

- (NSData *)returnSomething 
{
    // uses 4 spaces for indentation
    return data;
}
View My singleton implementation.
#pragma mark Singleton stuff
static id _sharedInstance;
+ (EKCoreDataProvider *)sharedInstance
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedInstance = [[EKCoreDataProvider alloc] init];
});
You can’t perform that action at this time.