Rest API calling using RxSwift.


Today, I am going to show how to call rest API using RxSwift. Before the start, we need to know some concept in RxSwift. RxSwift is the swift implementation of popular Reactive Extensions (Rx) library created by Microsoft.

What is Reactive programming?

Reactive programming is an declarative programming paradigm concerned with data streams and the propagation of change. This means that it becomes possible to express static (e.g. arrays) or dynamic (e.g. event emitters) data streams with ease via the employed programming language(s).


1. Observables: is like a function with some special characters.

2.Observer: Observables produce some result according to data or action. This Result is called the Observer.

For example: .subscribe(next, error, complete) 

Here subscribe is Observableandnext, error, complete are Observer.

3.DisposeBag: This is used to deinit() Observer objects from the memory.

Let start the implementation of RxSwift.

Step 1: Create a new project and pod file

Add RxSwift and RxCocoa in your pod file and install the pod.


Step 2: Creare a Model Class


Step 3: Create an API Request

Create an enum for request type which is helping to manage the API request Type.


Create a class for API Request


Configure the API request.

Now calling API.

Step 4: Create an APICalling class and DisposeBag object.


Load TableView after API call.

I hope it will help everyone.


. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • Armughangul
    brilliant article
  • Dave Chambers
    Great post Debabrata – very interesting!
  • Rahul Jamba
    Great Post, very simple explanation !!!!!!!!!!
  • css.php

    We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.

    Markus Walter

    Markus Walter

    Founder, Das Apartment Living

    Talk to Sales


    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home