Protocols
The following protocols are available globally.
-
Delegate of
See moreAPIAdapterused for platform-specific functionality (showing/hiding network activity indicator) and signing/manipulating URL request before they are sent.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
See moreURLSessionis available asURLSessionAPIAdapter.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
See morestruct. It is of course possible usingenumorclass. 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 helpfulDeclaration
Swift
public protocol APIEndpoint -
Endpoint protocol extending
See moreAPIEndpointhaving decodable associated type, which is used for automatic deserialization.Declaration
Swift
public protocol APIResponseEndpoint : APIEndpoint -
Endpoint protocol extending
See moreAPIEndpointencapsulating and improving sending JSON models to API.Declaration
Swift
public protocol APIRequestEndpoint : APIEndpoint
View on GitHub
Protocols Reference