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: https://github.com/caneronat/todolistapp/commits/feature/basic-files

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:

https://github.com/caneronat/todolistapp/tree/feature/splash-screen

Home Page:

https://github.com/caneronat/todolistapp/tree/feature/home-screen

Detail Page:

https://github.com/caneronat/todolistapp/tree/feature/detail-screen

AddTask Page:

https://github.com/caneronat/todolistapp/tree/feature/add-task-screen

UpdateTask Page:

https://github.com/caneronat/todolistapp/tree/feature/update-task-screen

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.

https://medium.com/media/03fee4211210fe10b5e4e3b590adff52/href

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.

https://medium.com/media/7de770bf0a88500b1e0603e7bfb53b54/href

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.

https://medium.com/media/253dc698f2b15b6a650b8e620c50a56d/href

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

https://medium.com/media/7efa95b9ee0486ae304fea71bf504f9e/href

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

https://medium.com/media/9f2b16034ca7b51ade5da6cbd38163ef/href

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

GitHub – caneronat/todolistapp

en_USEnglish