Realmβ

Realm is a mobile database: a replacement for Core Data & SQLite.
Realm lets you build apps faster, build apps that are faster, and craft amazing user experiences.

 

Sign up to receive regular tips, learn about other use-cases and get alerted of blogposts & tutorials about Realm!


“Finally an elegant, low-footprint and multi-platform database for apps… and so beautifully designed too.”  *
David Helgason, CEO, Unity3D
“Your technology is possibly the first truly novel idea I've seen in software in 20 years.” *
Kostadis Roussos, Distinguished Engineer, Juniper
“I got up and running with Realm in literally a few minutes. It's really simple to use, and understand, especially compared to Core Data.” *
Rick Fillion, Black Pixel

What Does Realm Look Like?

Feels like Home

Realm’s data structures look like the Objects and Arrays of your language, but provide additional features such as: querying, relationships & graphs, thread safety, and more.

Compared to Core Data, you get a much simpler API, easy thread-safety and much improved performance on reads & writes.

Memory-Efficient

Realm is not built on SQLite. Instead, a custom C++ core is used to provide memory-efficient access to your data by using Realm objects, which usually consume less RAM than native objects. The core also provides an optional persistence layer that can automatically save and retrieve your objects from disk.

F-F-Fast!

Realm offers extraordinary performance compared to SQLite and other persistence solutions.
It has been in development since 2011 and powers an app with over 1 million daily active users at a major mobile game company.

Realm Objects Look like Regular Objects…

class Dog: RLMObject {
    dynamic var name = ""
    dynamic var age = 0
}

let mydog = Dog()

mydog.name = "Rex"
println("name of dog: \(mydog.name)")
@interface Dog : RLMObject
@property NSString *name;
@property NSInteger age;
@end

Dog *mydog = [[Dog alloc] init];

mydog.name = @"Rex"; 
NSLog(@"Name of dog: %@", mydog.name);

Offer Easy Persistence…

// Optional: turn off persistence
RLMRealm.useInMemoryDefaultRealm()

let realm = RLMRealm.defaultRealm()

realm.beginWriteTransaction()
realm.addObject(mydog)
realm.commitWriteTransaction()
// Optional: turn off persistence
[RLMRealm useInMemoryDefaultRealm]; 

RLMRealm *realm = [RLMRealm defaultRealm];

[realm beginWriteTransaction];
[realm addObject:mydog];
[realm commitWriteTransaction];

Can be Queried…

let r = Dog.objectsWhere("age > 8")

let r2 = r.objectsWhere("name contains 'rex'")
RLMArray *r = [Dog objectsWhere:@"age > 8"];
 
// Queries are chainable!
r = [r objectsWhere:@"name contains 'rex'"];

Linked to Each Other…

class Person : RLMObject {
    dynamic var name = ""
    dynamic var picture = NSData()
    dynamic var dogs = RLMArray(objectClassName: Dog.className())
}

let person = Person()
person.name = "Tim"
person.dogs.addObject(mydog)
@interface Person : RLMObject
@property NSString      *name;
@property NSData        *picture;
@property RLMArray<Dog> *dogs;
@end

RLMPerson *person = [[RLMPerson alloc] init];
person.name = @"Tim";
[person.dogs addObject:mydog];

… And are Safe to Use Across Threads!

dispatch_async(dispatch_create_queue("background", 0)) {
  let realm = RLMRealm.defaultRealm()
  let results = Dog.objectsWhere("name contains 'rex'")
}

// You can write to any Realm from any thread too
// with full ACID guarantees
dispatch_async(dispatch_create_queue("background", 0), ^{
  RLMRealm *realm = [RLMRealm defaultRealm];
  RLMArray *results = [Dog objectsWhere:@"name contains 'rex'"];
}

// You can write to any Realm from any thread too
// with full ACID guarantees
Download for iOS+OSX
or take a look at the docs