SynchronousOperation

public class SynchronousOperation : ConcurrentOperation

It allows synchronous tasks, has a pause and resume states, can be easily added to a queue and can be created with a block.

  • Set the Operation as synchronous.

    Declaration

    Swift

    override public var isAsynchronous: Bool { get }
  • Notify the completion of async task and hence the completion of the Operation. Must be called when the Operation is finished.

    Declaration

    Swift

    override public func finish(_ hasFailed: Bool)

    Parameters

    hasFailed

    Set it to true if the Operation has failed, otherwise false.

  • Advises the Operation object that it should stop executing its task.

    Declaration

    Swift

    override public func cancel()
  • Execute the Operation. If executionBlock is set, it will be executed and also finish() will be called.

    Declaration

    Swift

    override public func execute()