Latest 1.0.1
License MIT
Platforms ios 11.0

Generic client base class to make asynchronous web requests and decode generic json data


There are two options for installing: You can either clone/fork this repository and use the source code yourself, or use cocoapods.


If you want to include this in your xcode project using cocoapods, you must do the following:

  • Install cocoapods on your computer by running the following command in the terminal:
    sudo gem install cocoapods

    You can find further help here:

  • Create a Podfile using the pod init command. Further information on Podfiles can be found here:
  • Point the Podfile to GenericAPIClient, like so:
    target 'MyApp' do
    pod 'GenericAPIClient'
  • Once you have that Podfile, use the pod install command to install the GenericAPIClient dependency into your xcode project. Then enter your project and build it.

A walkthrough of this process can be found here:


There is an example describing all of the options when making an API endpoint for your client. Once you read and understand that, the process is simple:

Simply create an APIClient object with the base URL of your API like this:

let exampleClient: APIClient = APIClient("")

Create an endpoint for it, and you can call for that endpoint like this:

exampleClient.send(request: ExampleEndpoint(exampleParameter: 5, exampleExtraPathComponent: "json")) { response in
    switch response {
        case .success(let data):
            // Handle your data here
        case .failure(let error):
            //Handle your error here

Latest podspec

    "name": "GenericAPIClient",
    "version": "1.0.1",
    "summary": "Generic web requesting class.",
    "description": "Generic API class to fetch generic json data from API endpoints.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Zhendryk": "[email protected]"
    "platforms": {
        "ios": "11.0"
    "source": {
        "git": "",
        "tag": "1.0.1"
    "source_files": [
        "GenericAPIClient/**/*.{h,m, .swift}"
    "exclude_files": "Example/ExampleEndpoint.swift",
    "swift_version": "4.2"

Pin It on Pinterest

Share This