for Core Data/SQLite •Implemented from scratch, based on ORM model •Fast performance, simple API, thread-safe •Free! •Cross-platform (Mac, iOS, Android, more soon…)
var name = “” dynamic var age = 0 dynamic var birthdate = NSDate.date() dynamic var height = 0.0 dynamic var vaccinated = true let puppies = List<Dog>() } Subclass ‘Object’ and add your properties. Int8 Int16 Int32 Int64 List<Object> Object Bool Double Float String NSDate NSData Supported Types
to disk let dogs = Realm().objects(Dog) //Filter the dogs by age let puppies = dogs.filter(“age < 2”) //Sort the puppies by name let sortedPuppies = puppies.sort(“name”)
the database let dog = Realm().objects(Dog).first //INCORRECT - An exception will be thrown dog.name = “Jabba the Mutt” //Correct - Object will be updated Realm().write { dog.name = “Jabba the Mutt” } Modifying Realm model objects must be done inside a write transaction.
exception will be thrown if a Realm model object and a Realm object mismatch is detected. •A Realm configuration object allows the supplying of a block that will be called to migrate existing data to a new schema. •Sample code available at http://realm.io/docs/swift