Skip to content

Instantly share code, notes, and snippets.

@Ramshandilya
Ramshandilya / AsynchronousOperation.swift
Created November 18, 2019 19:09 — forked from Sorix/AsynchronousOperation.swift
Subclass of NSOperation (Operation) to make it asynchronous in Swift 3, 4, 5
// Created by Vasily Ulianov on 09.02.17, updated in 2019.
// License: MIT
import Foundation
/// Subclass of `Operation` that adds support of asynchronous operations.
/// 1. Call `super.main()` when override `main` method.
/// 2. When operation is finished or cancelled set `state = .finished` or `finish()`
open class AsynchronousOperation: Operation {
public override var isAsynchronous: Bool {