Recently, there's been released a very interesting tool for iOS Developers (and soon Android too). That is Realm. Realm is a mobile database that aims at replacing CoreData and SQLite. What really impressed me is that Realm is not only very well built, but also very fast. Surprisingly way faster than CoreData and SQLite! In this post I will share with you 5 reasons why you should already choose Realm over CoreData/SQLite for your next project.
1. Ease of use
I've never really been a fan of CoreData and i am sure many of you feel the same. Sure, it's a powerful tool, but it's not so easy to catch up and maintain. On the other side, Realm, couldn't be easier to use. Realm data models are defined using traditional NSObject-style classes with @properties. Simply subclass RLMObject to create your Realm data model objects.
Realm objects can be instantiated and used standalone just like regular objects. To share objects between threads or re-use them between app launches, you must add and retrieve them from a Realm. All changes to an object (addition, edition and deletion) have to be done through write transactions:
Easy as that! No more NSManagedObjects, NSPersistentStoreCoordinators, etc.
I was really surprised to see that Realm is actually faster than other popular mobile data storage solution. Especially the queries speed. Needless to say anything about it. Just check the benchmarks bellow.
3. Realm Browser
There are a few solution to explore your CoreData database independently, but many of those are either expensive or not working. A few of them: SQLite Professional, Core Data Editor, Core Data Pro, etc. The amazing engineers at Realm thought about this too. They provided an utility called Realm Browser. It allows you to easily explore your Realm databases and guess what? You can even edit them!
Soon, Realm will be available for Android too. I was told that you could use the same .realm databases across multiple platforms. Just imagine what you could develop with that huge advantage of sharing the same data models over iOS & Android. That's something you could very hardly achieve using CoreData/SQLite. Besides that, Realm is in continuous development, so we might see some more platforms support in the future.
5. Free, Well-documented, Other Features
Some of you might not be surprised that Realm is free, but just take a look at all the advantages you have compared to other similar solutions and you'll see that this is a pretty awesome. The guys at Realm worked really hard on their documentation and what i especially like is that is very straight forward. If you have a question on a related feature, you will easily find your answer. One more thing some developers might like is that Realm supports Objective-C as well as Swift, which suggests that this would be a long-term solution for iOS Developers.
I didn't went in much technical details about it, but Realm means way more than you've just read. Right now it's in very early stages but with the help of an amazing community, i am sure it will grow a lot. It supports relationships, migrations, background operations, notifications, etc. I highly recommend you to check it out on Realm.io and give it a chance for your next project. I promise you won't be disappointed.