Realm database working with IOS.

Posted by


In this tutorial I am going to guide how to integrate Realm database into IOS swift language.

Let save your time. I just focus on some main functions such as insert, delete and update. That’s enough to apply your project. if you want to know more Realm database you can go officially page Realm Database .

In this guide I am using latest version is 3.7.2.

Let’s get started.

Download Now

  1. Creating project.
    • From Xcode tool File->New->Project
  2. Downloading Realm and RealmSwift.
    • Realm Framework or you can go officially site
    • After download and unzip you will get 2 files.
    • In this tutorial I choose Swift 4.1
    • Copy 2 file to your project
    • From IOSWithRealmDatabase-> Target and then drag and drop 2 files to Embedded Binaries area.
  3. Creating TaskManager class into model folder and extend Realm Object.
    • First of all you need to import RealmSwift into your class.

    • And now you need to create some functions insert, update and delete.

    • Full code

  4. Design UI.
    • You are going to drag and drop view and tableview. in order to show data on Tableview.
    • Make sure mapping datasource and delegate to tableview
    • Mapping UI to Viewcontroller
  5. Calling insert, delete and update functions to ViewController.
    • Getting all item

    • Inserting and updating

    • Deleting

    • Calling TableViewCell in order to display data.

    • Full code

  6. Running app and getting result


Realm database or CoreData depend on your solution. but all of them is best to apply to your project. in my point view I love doing with Realm Database. It’s make easy for me to maintain feature in the future.

If you have a question. you can leave your comment below. I will try to answer as soon as possible.

Wish happy coding.


One comment

Leave a Reply

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