FutureResult
public enum FutureResult<T>
Defines a simple enumeration of the legal Completion states of a Future.
- case Success(T): the Future has completed Succesfully.
- case Fail(ErrorType): the Future has failed.
- case Cancelled: the Future was cancelled. This is typically not seen as an error.
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
returns a .Fail(FutureNSError) with a simple error string message.
Declaration
Swift
public init(failWithErrorMessage : String)
-
converts an NSException into an NSError. useful for generic Objective-C excecptions into a Future
Declaration
Swift
public init(exception ex:NSException)
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
make sure this enum is a .Success before calling
result
. Do a check ‘completion.state {}` or .isFail() first.Declaration
Swift
public var value : T!
-
make sure this enum is a .Fail before calling
result
. Use a switch or check .isError() first.Declaration
Swift
public var error : ErrorType!
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
convert this completion of type Completion
into another type Completion .may fail to compile if T is not convertable into S using
`as!`
works iff the following code works:
‘let t : T`
‘let s = t as! S’
- example:
let c : FutureResult<Int> = .Success(5)
let c2 : FutureResult<Int32> = c.As()
assert(c2.result == Int32(5))
you will need to formally declare the type of the new variable, in order for Swift to perform the correct conversion.
Declaration
Swift
public func As<S>() -> FutureResult<S>
-
convert this completion of type Completion
into another type Completion .may fail to compile if T is not convertable into S using
`as!`
works iff the following code works:
‘let t : T`
‘let s = t as! S’
- example:
let c : FutureResult<Int> = .Success(5)
let c2 : FutureResult<Int32> = c.As()
assert(c2.result == Int32(5))
you will need to formally declare the type of the new variable, in order for Swift to perform the correct conversion.
Declaration
Swift
public func mapAs<S>() -> FutureResult<S>
-
convert this completion of type
Completion<T>
into another typeCompletion<S?>
.WARNING: if
T as! S
isn’t legal, than all Success values may be converted to nil - example:let c : FutureResult
= .Success( 5
) let c2 : FutureResult<[Int]?> = c.convertOptional() assert(c2.result == nil)you will need to formally declare the type of the new variable, in order for Swift to perform the correct conversion.
Declaration
Swift
public func convertOptional<S>() -> FutureResult<S?>
Return Value
a new result of type Completion
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
Undocumented
Declaration
Swift
public enum FutureResult<T>
-
Undocumented
Declaration
Swift
public enum FutureResult<T>