Having a codebase that is managed, structured, clean and scalable and will be very helpful as your codebase grows and features keeps on getting added in your application. So, in this we are going to setup our iOS project following Clean Code Architecture using RxSwift and we’ll be using Swinject for dependency injection.

So, let get on with it.

1. First create a new Xcode project. We are going to use Swift Package Manager to add libraries in our project.

We are going to add these libraries in our project.

  • RxSwift
  • Swinject
  • RxAlamofire — This is for performing network requests.

We all use libraries in our projects for faster development of applications. Here are some of the libraries that I use in most of my projects.

1. RxAlamofire
Almost all of the apps developed today requests data from server and loads it in the app. If you love to use RxSwift in your apps then RxAlamofire is must to perform network requests. It makes your network requests reactive.

2. RxSwift

RxSwift is my Go-to library for writing business logic layer in any application I write. It makes it so much easier to manipulate responses obtained from server in whichever way…

We’ve all been there. We all know how frustrating it is when it comes to uploading our app to TestFlight. A lot of next and proceed buttons to tap till it successfully uploads to the TestFlight.

Using fastlane, we can skip all that hassles and can push our build to TestFlight with just one line of code i.e.

bundle exec fastlane beta

That would save u a lot of time in the long run. So, for the above code to work firstly we have to do some setup in our project. Let’s get on it then.

  1. There are multiple ways…


Segregating the features in our application is very fruitful for maintaining the application as our application keeps on growing. It helps us in rapid development of new features.

Note: We are going to be using cocoapods for creating modules.

  1. Create a new project or open your existing project in Xcode.
  2. Open Terminal in root directory of your project.
  3. Type “pod init” in terminal and hit Enter.
  4. Now let’s add Login Module in our application. Create a directory named “Modules” and execute “cd Modules” in terminal.
  5. Now being in Modules directory execute “pod lib create Login” in terminal. …

When we are developing our apps we have one backend base URL for testing purpose and another one when pushing the app in live environment.

If you have been manually managing this by commenting out the testing phase base URL uncommenting the live base URL every time you archive and push your app to production, you know how much of a hassle it is. Sometimes you may even forget to do that and push the app pointed to test URL.

If this has happened to you before and you want to avoid such mistakes then here is a solution for…

In this tutorial we are going to implement push notification in our iOS app using firebase.

For this tutorial, we are going to need:

  1. Postman
  2. Xcode
  3. Good Understanding on cocoapods.

Step One:

Create a new Xcode project and integrate cocoapods in it. In Podfile, add:

pod ‘Firebase/Messaging’

pod ‘HandyJSON’

Run pod install and build the project.

Step Two:

Go to Signing & Capabilities in project and add capability named Push Notifications.

Step Three:

In AppDelegate, import Firebase and inside didFinishLaunchingWithOptions function, add:


Step Four:

Create a new project in https://console.firebase.google.com/ for your app. Add an iOS app in that…

In our iOS apps, alerts are used in various screens of the app for notifying users for various cases that occurs in app like success, error, information etc.

So, we all know how to create an alert. It is as follows:

A Simple Alert

So, if you use this type of simple alerts in your app in most places with varying title and description. We can move forward two ways instead of creating alert in every ViewController.

  1. Create a BaseViewController.swift and add a func that shows the alert and every other ViewController is subclassed from BaseViewController.
  2. Create a UIViewController extension and add…

There may come a time we need to implement contact picker in our application. Users may have more than one phone number saved under a contact name. So, users should be able to choose one from the saved numbers.

Let’s get to coding.

That’s it. Now you can use contact picker in your app as desired.


Don’t know about you devs but I like my network responses pretty printed. This is because I’m picky about these things and also it helps me debug if my application behaves not the way i intended to.

What we’re trying to achieve:

Printing JSON response in Debug View

Let’s dive into it.

When we make a network request using URLSession, we get Data from server response. So let’s create extensions of Data and Dictionary.

Data + Extensions.swift
Dictionary + Extensions.swift

Now in your APIService class (from where you perform network requests), print the obtained response as: (line no. 18)

What we’ve done is:

  1. First we…

Most of the mobile applications basically function by fetching data from the server and makes requests to the server based on the user action performed.

So, in our application we have a NetworkService or ApiService class that handles most of the network related works i.e. GET and POST requests.

For example, we have obtain following json data from the url:


So, for that we firstly create a new class named APIService.swift:

The above shown gist has the necessary generic methods to handle GET and POST requests.

Now comes the part where we perform network requests.

Note: I’ve…

Nabin Shrestha

iOS Developer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store