Protocols

The following protocols are available globally.

  • Delegate of APIAdapter used for platform-specific functionality (showing/hiding network activity indicator) and signing/manipulating URL request before they are sent.

    See more

    Declaration

    Swift

    public protocol APIAdapterDelegate : AnyObject
  • Protocol describing interface communicating with API resources (most probably over internet). This interface encapsulates executing requests.

    Standard implementation of this interface using URLSession is available as URLSessionAPIAdapter.

    See more

    Declaration

    Swift

    public protocol APIAdapter
  • Protocol describing API endpoint. API Endpoint describes one URI with all the data and parameters which are sent to it.

    Recommended conformance of this protocol is implemented using struct. It is of course possible using enum or class. Endpoints are are not designed to be referenced and used instantly after creation, so no memory usage is required. The case for not using enums is long-term sustainability. Enums tend to have many cases and information about one endpoint is spreaded all over the files. Also, structs offer us generated initializers, which is very helpful

    See more

    Declaration

    Swift

    public protocol APIEndpoint
  • Endpoint protocol extending APIEndpoint having decodable associated type, which is used for automatic deserialization.

    See more

    Declaration

    Swift

    public protocol APIResponseEndpoint : APIEndpoint
  • Endpoint protocol extending APIEndpoint encapsulating and improving sending JSON models to API.

    See more

    Declaration

    Swift

    public protocol APIRequestEndpoint : APIEndpoint
  • Undocumented

    See more

    Declaration

    Swift

    public protocol APIError : Error