Skip to content

Instantly share code, notes, and snippets.

import Foundation
infix operator +=! { associativity right precedence 90 } // Int32 or Int64
infix operator -=! { associativity right precedence 90 } // Int32 or Int64
postfix operator ++! {} // Int32 or Int64
postfix operator --! {} // Int32 or Int64
infix operator |=! { associativity right precedence 90 } // UInt32
infix operator &=! { associativity right precedence 90 } // UInt32
@svd-zp
svd-zp / WeakifyExplained.mm
Created March 15, 2017 13:33 — forked from dodikk/WeakifyExplained.mm
Explanation of __weak and __strong keywords
void foo()
{
// __strong guarantees that the object is "alive" until the end of foo() stack frame. The __strong keyword is used implicitly and may be omitted.
// Unless it's retained by other objects
__strong SomeObjectClass *someObject = ...
// __weak does not let the block increase the retain count of "someObject"
//
__weak SomeObjectClass *weakSomeObject = someObject;
@svd-zp
svd-zp / QueueThreads.swift
Created March 15, 2017 13:33 — forked from anonymous/QueueThreads.swift
QueueThreads
import Cocoa
class ViewController: NSViewController {
var queue = DispatchQueue(label: "Queue", qos: .background, attributes: .concurrent)
override func viewDidLoad() {
super.viewDidLoad()
(0..<1000).forEach { i in self.queue.async { Thread.sleep(forTimeInterval: 30.0) } }
}
@svd-zp
svd-zp / SpinlockTestTests.swift
Created March 15, 2017 13:32 — forked from steipete/SpinlockTestTests.swift
Updated for Xcode 8, Swift 3; added os_unfair_lock
//
// SpinlockTestTests.swift
// SpinlockTestTests
//
// Created by Peter Steinberger on 04/10/2016.
// Copyright © 2016 PSPDFKit GmbH. All rights reserved.
//
import XCTest
@svd-zp
svd-zp / ios-questions-interview.md
Created March 4, 2017 20:21 — forked from arturlector/ios-questions-interview.md
Вопросы на собеседование iOS разработчика.

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

General:

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

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

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

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

@svd-zp
svd-zp / ios-questions-interview.md
Created March 4, 2017 20:21 — forked from arturlector/ios-questions-interview.md
Вопросы на собеседование iOS разработчика.

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

General:

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

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

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

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

@svd-zp
svd-zp / obejctveic.m
Created January 2, 2017 14:28 — forked from PaulTaykalo/obejctveic.m
Objectvive-C Runtime and typedef
@interface Item : NSObject @end
@implementation Item @end
typedef NSArray<Item *> Items;
@interface Cooler : NSObject
- (id)updateItems:(Items *)items;
- (id)updateItems2:(NSArray<Item *> *)items;
@end
@svd-zp
svd-zp / CoreDataStack.swift
Created January 2, 2017 12:46 — forked from soxjke/CoreDataStack.swift
ManagedObjectMapper
import CoreData
public class CoreDataStack {
// 2
public let model:NSManagedObjectModel
public let persistentStoreCoordinator:NSPersistentStoreCoordinator
public let context:NSManagedObjectContext
public init() {
// 3.1
@svd-zp
svd-zp / ioslocaleidentifiers.csv
Created December 29, 2016 14:46 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)