Networking
public protocol Networking
Basic networking protocol
-
Sends a request to the server and the response can be subscribed to
Declaration
Swift
func response(for request: URLRequest) -> Observable<(response: HTTPURLResponse, data: Data?)>
Parameters
request
request sent to server
session
session used for communication
Return Value
An Observable of the
HTTPURLResponse
andData
if there is any -
Sends a request to the server and the response data can be subscribed to
Declaration
Swift
func data(for request: URLRequest) -> Observable<Data>
Parameters
request
request sent to server
session
session used for communication
Return Value
An Observable of the
Data
if there is any -
Sends a request to the server and the response data are transformed into object of type
T
and it can be subscribed toDeclaration
Swift
func object<T>(for request: URLRequest) -> Observable<T> where T : Decodable, T : Encodable
Parameters
request
request sent to server
session
session used for communication
Return Value
An Observable of
T
-
Sends a request to the server and the response data in JSON format can be subscribed to
Declaration
Swift
func json(for request: URLRequest) -> Observable<JSONDictionary>
Parameters
request
request sent to server
Return Value
An Observable of the
JSONDictionary