Start a Project

CRUD Operation with Realm

Hi guys, today we will learn about how to implement CRUD Operation with realm() in an iOS application.

Before starting to code first we need to know what a Realm() is

Realm() is a cross-platform mobile object database. It’s very fast, performance, and easy to use as compared to core data and SQLite. It is written in cross-platform C++, so it works exactly the same way on Android, iOS, macOS, or any other platform.

Realm()

Most of the Realm() is open-source, but the secret sauce behind Realm() Platform is the core DB engine written from scratch in C++.

code of CRUD Operation-

Create –  In it, we can create a realm() Data.

For example-

Read – In it, we can read a realm() Data.

For example-

Update – In it, we can Update a realm() Data.

For example-

 

Delete – In it, we can Delete a realm() Data.

For example-

Step of CRUD Operation –

  1. install cocoa pods in Xcode
  2. install realm pod file in Xcode
  3. realm pod – pod ‘RealmSwift’
  4. start working on code

Example of CRUD Operation –

we have taken an example where we know how to create, save, and update data in the realm().

step 1:-

create realmModel.swift file

step 2: 

Create a view controller

                                                       

step 3:

Create Table view Cell

step 4

Create view Controller

It looks like this

           .    .     

 

Conclusion

In this blog, we have discussed how to save, update, and delete the data in the database by using the CRUD Operation with Realm().

I hope this blog will help you in getting some basic knowledge about the CRUD Operation with Realm().

Thanks for reading!

Exit mobile version