Structures

The following structures are available globally.

  • An Authentication for RESTful Services.

    var authentication = Authentication()
    authentication.credential = URLCredential(
        user: "user",
        password: "password",
        persistence: .forSession
    )
    
    See more

    Declaration

    Swift

    public struct Authentication
  • A Configuration for RESTful Services. You must provide a host.

    var configuration = Configuration()
    configuration.scheme: String = "https"
    configuration.baseURL = "www.mocky.io"
    configuration.version = "v2"
    configuration.headers = ["Content-Type": "application/json"]
    
    See more

    Declaration

    Swift

    public struct Configuration
  • A Poll for RESTful Services.

    var poll = Poll()
    poll.pollingInterval = 1.0
    
    See more

    Declaration

    Swift

    public struct Poll
  • A Queues for RESTful Services.

    var queues = Queues()
    queues.completionQueue = DispatchQueue.main
    
    See more

    Declaration

    Swift

    public struct Queues
  • A Reachability for RESTful Services.

    var reachability = Reachability()
    reachability.eventually = true
    reachability.networkReachabilityManager = NetworkReachabilityManager()!
    
    See more

    Declaration

    Swift

    public struct Reachability
  • A Retry for RESTful Services.

    var retry = Retry()
    retry.retryErrorCodes = [.timedOut,.networkConnectionLost]
    retry.retryInterval = 20
    retry.maxRetryAttempts = 10
    
    See more

    Declaration

    Swift

    public struct Retry
  • A Session for RESTful Services.

    Session.default.session = {
        let sessionConfiguration = URLSessionConfiguration.default
        sessionConfiguration.timeoutIntervalForRequest = 7
        sessionConfiguration.timeoutIntervalForResource = 7
        sessionConfiguration.HTTPAdditionalHeaders = Manager.defaultHTTPHeaders
        return Session(configuration: sessionConfiguration)
    }
    
    See more

    Declaration

    Swift

    public struct SessionManager
  • A Validation for RESTful Services.

    var validation = Validation()
    validation.acceptableStatusCodes = Array(200..<300)
    validation.acceptableContentTypes = ["application/json"]
    
    See more

    Declaration

    Swift

    public struct Validation