Skip to content

Realm is a mobile database: a replacement for Core Data & SQLite

License

Notifications You must be signed in to change notification settings

shaozg/realm-cocoa

Repository files navigation

Realm

Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the iOS & OSX versions of Realm, for both Swift & Objective-C.

Features

  • Mobile-first: Realm is the first database built from the ground up to run directly inside phones, tablets and wearables.
  • Simple: Data is directly exposed as objects and queryable by code, removing the need for ORM's riddled with performance & maintenance issues. Plus, we've worked hard to keep our API down to just 3 common classes (Object, Arrays and Realms) and 1 utility class (Migrations): most of our users pick it up intuitively, getting simple apps up & running in minutes.
  • Modern: Realm supports relationships, generics, vectorization and even Swift (experimental).
  • Fast: Realm is faster than even raw SQLite on common operations, while maintaining an extremely rich feature set.

Setting up Realm in your app

There are two ways to set up Realm in your app: manually or with CocoaPods.

Manually:

  1. Download the latest release of Realm and extract the zip (or build it from source).
  2. Drag Realm.framework from our release and into the Frameworks folder in your project in Xcode. Make sure Copy items into destination group’s folder is selected and press Finish.
  3. Click on the project in the Xcode file explorer. Select your target and go to the Build Phases tab. Under Link Binary with Libraries press + and add libc++.dylib.

CocoaPods:

  1. Add the following to your Podfile: pod "Realm".
  2. From the command line, run pod install.
  3. Use the .xcworkspace file generated by CocoaPods to work on your project!

Once your app is set up with Realm, our documentation will guide you to unleash its full potential.

Documentation

Documentation for Realm can be found at realm.io/docs/ios. The API reference is located at realm.io/docs/ios/latest/api.

Building Realm

In case you don't want to use the precompiled version, you can build Realm yourself.

Prerequisites:

  • Building Realm requires Xcode 5 or above
  • Building Realm with Swift support requires Xcode6-Beta3 specifically
  • Building Realm documentation requires appledoc

Once you have all the necessary prerequisites, building Realm.framework just takes a single command: sh build.sh ios. You'll need an internet connection the first time you build Realm to download the core binary.

Run sh build.sh help to see all the actions you can perform (build ios/osx, generate docs, test, etc.).

Executing the examples under the /examples folder, requires that you have built the Realm.framework.

Contributing

We would love your contributions to Realm! For legal reasons we do need to make a CLA, which we are in the process of defining. Until that's published here, your are welcome to make a Pull Request, but we will have to copy your contribution into a new PR with your permission and close the original PR.

License

Realm Cocoa is published under the Apache 2.0 license.

analytics

About

Realm is a mobile database: a replacement for Core Data & SQLite

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 45.9%
  • Objective-C++ 33.2%
  • Swift 13.5%
  • Shell 2.7%
  • C++ 1.6%
  • CSS 1.2%
  • Other 1.9%