Skip to content

Instantly share code, notes, and snippets.

View esphynox's full-sized avatar
🖥️

Serhii Bykov esphynox

🖥️
View GitHub Profile
public class AsyncOperation: Operation {
@objc enum State: Int {
case ready
case executing
case finished
}
private let stateQueue = DispatchQueue(label: "\(Bundle.main.bundleIdentifier!).AsyncOperation.state", attributes: .concurrent)
private var _state: State = .ready
@esphynox
esphynox / EncodingHeterogenousArrays.swift
Last active October 19, 2018 09:37
Decoding heterogenous arrays with base protocol in Swift 4
import Foundation
protocol Item: Codable {
static var type: ItemType { get }
var commonProtocolString: String { get }
}
enum ItemType: String, Codable {