Protocols

The following protocols are available globally.

  • A type used to define how a set of array parameters are applied to a URLRequest.

    See more

    Declaration

    Swift

    public protocol ArrayParameterEncoding
  • Represents a Downloadable for Restofire.

    protocol HTTPBinDownloadService: Downloadable {
    
        var path: String? = "bytes/\(4 * 1024 * 1024)"
        var destination: DownloadFileDestination?
    
        init(destination: @escaping DownloadFileDestination) {
            self.destination = destination
        }
    
    }
    
    See more

    Declaration

    Swift

    public protocol Downloadable: ADownloadable, Configurable, DownloadResponseSerializable
  • Represents a StreamUploadable for Alamofire.

    Create custom StreamUploadable

    protocol HTTPBinUploadService: AStreamUploadable {
    
        var path: String? = "post"
        var stream: InputStream = InputStream(url: FileManager.imageURL)!
    
    }
    
    See more

    Declaration

    Swift

    public protocol AStreamUploadable: _AUploadable
  • Represents a Uploadable for Alamofire.

    Use sub protocols - AFileUploadable, ADataUploadable, AStreamUploadable, AMultipartUplodable

    See more

    Declaration

    Swift

    public protocol _AUploadable: ARequestable
  • Represents a DataUploadable for Alamofire.

    Create custom DataUploadable

    protocol HTTPBinUploadService: ADataUploadable {
    
        var path: String? = "post"
        var data: Data = {
            return "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
               .data(using: .utf8, allowLossyConversion: false)!
        }()
    
    }
    
    See more

    Declaration

    Swift

    public protocol ADataUploadable: _AUploadable
  • Represents a MultipartUploadable for Alamofire.

    Create custom MultipartUploadable

    protocol HTTPBinUploadService: AMultipartUploadable {
    
        var path: String? = "post"
        var multipartFormData: (MultipartFormData) -> Void = { multipartFormData in
            multipartFormData.append("français".data(using: .utf8)!, withName: "french")
            multipartFormData.append("日本語".data(using: .utf8)!, withName: "japanese")
        }
    
    }
    
    See more

    Declaration

    Swift

    public protocol AMultipartUploadable: _AUploadable
  • Represents a Configurable for URLSession. Configuration.default by default.

    Create custom Configurable

    protocol HTTPBinConfigurable: _Configurable { }
    
    extension HTTPBinConfigurable {
    
      var configuration: Configuration {
        var config = Configuration()
        config.host = "httpbin.org"
        return config
      }
    
    }
    
    See more

    Declaration

    Swift

    public protocol _Configurable
  • Represents a FileUploadable for Alamofire.

    Create custom FileUploadable

    protocol HTTPBinUploadService: AFileUploadable {
    
        var path: String? = "post"
        let url: URL = FileManager.url(forResource: "rainbow", withExtension: "jpg")
    
    }
    
    See more

    Declaration

    Swift

    public protocol AFileUploadable: _AUploadable
  • Represents a Downloadable for Alamofire.

    Create custom Downloadable

    protocol HTTPBinDownloadService: ADownloadable {
    
        var path: String? = "bytes/\(4 * 1024 * 1024)"
        var destination: DownloadFileDestination?
    
        init(destination: @escaping DownloadFileDestination) {
            self.destination = destination
        }
    
    }
    
    See more

    Declaration

    Swift

    public protocol ADownloadable: _Requestable, AConfigurable
  • Represents a Requestable for URLSession.

    Create custom Requestable

    protocol HTTPBinGETService: _Requestable {
    
        var path: String? = "get"
    
    }
    
    See more

    Declaration

    Swift

    public protocol _Requestable: _Configurable
  • Represents a Configurable for Restofire. Configuration.default by default.

    Create custom Configurable

    protocol HTTPBinConfigurable: Configurable { }
    
    extension HTTPBinConfigurable {
    
      var configuration: Configuration {
        var config = Configuration()
        config.host = "httpbin.org"
        return config
      }
    
    }
    
    See more

    Declaration

    Swift

    public protocol Configurable: AConfigurable, Reachable, Retryable, Queueable