GenericOperation
open class GenericOperation<T> : AsyncOperation
Represents AsyncOperation with Generic result
-
Operation Result WARNING: Do not modify this value outside of GenericOperation functions
Declaration
Swift
public var result: Result<T, Error>? { get set }
-
Creates OperationQueue and starts operation
Declaration
Swift
public func start(completion: @escaping (Result<T, Error>) -> Void)
Parameters
completion
Completion callback
-
Creates OperationQueue and starts operation
Declaration
Swift
public func start(completion: @escaping (T?, Error?) -> Void)
Parameters
completion
Completion callback
-
Creates queue, starts operation, waits for result, returns result
Declaration
Swift
public func startSync(timeout: TimeInterval? = nil) -> Result<T, Error>
Parameters
timeout
Operation timeout
Return Value
Operation Result
-
Finds first dependency with Result of correct type and returns its result, if operation has succeeded
Throws
GenericOperationError.missingDependencies, if no dependency with correct type was found GenericOperationError.dependencyFailed, if dependency has failedDeclaration
Swift
func findDependencyResult<T>() throws -> T
Return Value
Dependency Result
-
Finds dependency error
Declaration
Swift
func findDependencyError() -> Error?
Return Value
Dependency error