ResultProtocol

public protocol ResultProtocol

The ResultProtocol is for classes that parse a JSON result from on-premises or cloud.

  • Initialize an instance containing the exception.

    Remark

    Classes implementing ResultProtocol should assign a class private(set) variable to the error argument. “` public fileprivate(set) var error: Error?

    init(error: Error) { self.error = error }

    Declaration

    Swift

    init(error: Error)

    Parameters

    error

    An instance of the Error representing the error.

  • error Default implementation

    The type of error.

    Default Implementation

    The type of error.

    Declaration

    Swift

    var error: Error? { get }
  • errorDescription Default implementation

    The detailed information of the error.

    Default Implementation

    The detailed information of the error.

    Declaration

    Swift

    var errorDescription: String? { get }
  • hasError Default implementation

    The flag to indicate an error.

    Default Implementation

    The flag to indicate an error.

    Declaration

    Swift

    var hasError: Bool { get }
  • Parses the object into an ResultProtocol.

    Throws

    IBMMobileKitError.serverError, IBMMobileKitError.invalidDataFromServer

    Declaration

    Swift

    static func parse(_ data: [String : Any]) throws -> Self

    Parameters

    data

    The object to deserialize from.

    Return Value

    Deserialized ResultProtocol.