How to Make a Simple To-do List Application with Swift?

22/11/2021 9:46

Caner Onat, Mobilist

In this blog post, we will talk about how to make a simple to-do list application.

We will implement the application using the VIPER architecture and RxSwift, RxCocoa and Realm libraries. First, let's create the basis of our project. It is worth reminding at this point: If you are not using a version control system, it is a good idea to start using it immediately.

We use two loyalty managers to set an example in the project. One of them is COCOAPODS and the other is SPM. As can be seen from here, there is no harm in using more than one dependency manager.

Get detailed information about dependency managers:

After installing the relevant pods, we start creating ViewController, Presenter, Interactor, Entities and Router pages for each page in accordance with the VIPER architecture.

In the application, there are basically Splash, Home, Detail, AddTask and UpdateTask pages. Check out the commits we created while processing these pages:

Splash Page:

Home Page:

Detail Page:

AddTask Page:

UpdateTask Page:

In this blog post, we will focus only on the Home Page section in order to explain the basics of the subject. Other pages are designed in a similar way.

First, let's look at the ViewController section: There are tableviews and views on this page. Tableview is created to show the entered to-do list. View acts as emptyview when there is no tableview. Here, we only use the data from the presenter and do not do anything different.

In the Presenter section, it establishes the connection between the view controller and the interactor. We share the data received from the interactor with the view controller and enable the view controller to use it.

On the Interactor page, operations such as fetch and update are performed.

The router is the part where we decide when to show the pages of the application. Pages are displayed accordingly.

We are coming to the end of the project with this brief information. Get the final version below:

GitHub – caneronat/todolistapp