We currently have a swift IOS app that uses realm for data storage, discarding CoreData and SQLite.
Project Address Https://github.com/realm
Realm is an alternative to the mobile database, SQLite and ORM framework that runs directly on mobile, tablet, wearable devices. There are android,ios and react native JS versions. The Realm-cocoa project includes the Ios/os x version of OBJC and Swift implementations.
Characteristics:
- Mobile-first:realm is the first database to run directly on mobile, tablet, wearable device design and development
- Simple: Data directly exposed to class objects, through the code query, to avoid the ORM mapping maintenance and performance issues. In addition, realm strives to keep the API to include only 4 base classes (Object, Array, Results and Realms) and a tool class (migrations), which users can use intuitively, using realm in the app within minutes
- Modern:realm supports correlation, generics, vectorization, and even support for Swift.
- Fast:realm is faster than native SQLite in basic database operations, while maintaining a richer set of feature features.
The REALM-BROWSER-OSX project is a realm database client tool on a Mac that supports viewing and modifying realm database files, and functions like sqliteadmin.
Required conditions
IOS 8 or later, OS X 10.9 or later & WatchKit, iOS7.0 not supported, The reason is that iOS7.0 does not support third-party dynamic libraries, but contains swift code and cannot be compiled into a static library (but OBJC version realm supports iOS7.0). Xcode 7.0 or later, we recommend swift2.x above.
Sample Code
Import realmswift//Dog modelclass dog:object { dynamic var name = "" dynamic var Owner:person? Properties can be optional}//person Modelclass person:object { dynamic var name = "" dynamic var birthdate = NSDate (timeintervalsince1970:1) let dogs = List<dog> ()}
Mobile-specific Database Realm introduction