Classes

The following classes are available globally.

RLMAppConfiguration

  • Properties representing the configuration of a client that communicate with a particular Realm application.

    See more

    Declaration

    Objective-C

    @interface RLMAppConfiguration : NSObject

RLMApp

  • The RLMApp has the fundamental set of methods for communicating with a Realm application backend.

    This interface provides access to login and authentication.

    See more

    Declaration

    Objective-C

    @interface RLMApp : NSObject
  • RLMArray is the container type in Realm used to define to-many relationships.

    Unlike an NSArray, RLMArrays hold a single type, specified by the objectClassName property. This is referred to in these docs as the “type” of the array.

    When declaring an RLMArray property, the type must be marked as conforming to a protocol by the same name as the objects it should contain (see the RLM_ARRAY_TYPE macro). In addition, the property can be declared using Objective-C generics for better compile-time type safety.

    RLM_ARRAY_TYPE(ObjectType)
    ...
    @property RLMArray<ObjectType *><ObjectType> *arrayOfObjectTypes;
    

    RLMArrays can be queried with the same predicates as RLMObject and RLMResults.

    RLMArrays cannot be created directly. RLMArray properties on RLMObjects are lazily created when accessed, or can be obtained by querying a Realm.

    Key-Value Observing

    RLMArray supports array key-value observing on RLMArray properties on RLMObject subclasses, and the invalidated property on RLMArray instances themselves is key-value observing compliant when the RLMArray is attached to a managed RLMObject (RLMArrays on unmanaged RLMObjects will never become invalidated).

    Because RLMArrays are attached to the object which they are a property of, they do not require using the mutable collection proxy objects from -mutableArrayValueForKey: or KVC-compatible mutation methods on the containing object. Instead, you can call the mutation methods on the RLMArray directly.

    See more

    Declaration

    Objective-C

    @interface RLMArray<RLMObjectType> : NSObject <RLMCollection, NSFastEnumeration>

RLMBSON

  • MaxKey will always be the greatest value when comparing to other BSON types

    Declaration

    Objective-C

    @interface RLMMaxKey : NSObject
  • MinKey will always be the smallest value when comparing to other BSON types

    Declaration

    Objective-C

    @interface RLMMinKey : NSObject
  • An RLMSortDescriptor stores a property name and a sort order for use with sortedResultsUsingDescriptors:. It is similar to NSSortDescriptor, but supports only the subset of functionality which can be efficiently run by Realm’s query engine.

    RLMSortDescriptor instances are immutable.

    See more

    Declaration

    Objective-C

    @interface RLMSortDescriptor : NSObject
  • A RLMCollectionChange object encapsulates information about changes to collections that are reported by Realm notifications.

    RLMCollectionChange is passed to the notification blocks registered with -addNotificationBlock on RLMArray and RLMResults, and reports what rows in the collection changed since the last time the notification block was called.

    The change information is available in two formats: a simple array of row indices in the collection for each type of change, and an array of index paths in a requested section suitable for passing directly to UITableView‘s batch update methods. A complete example of updating a UITableView named tv:

    [tv beginUpdates];
    [tv deleteRowsAtIndexPaths:[changes deletionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
    [tv insertRowsAtIndexPaths:[changes insertionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
    [tv reloadRowsAtIndexPaths:[changes modificationsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
    [tv endUpdates];
    

    All of the arrays in an RLMCollectionChange are always sorted in ascending order.

    See more

    Declaration

    Objective-C

    @interface RLMCollectionChange : NSObject
  • Opaque credentials representing a specific Realm App user.

    See more

    Declaration

    Objective-C

    @interface RLMCredentials : NSObject
  • A 128-bit IEEE 754-2008 decimal floating point number.

    This type is similar to Swift’s built-in Decimal type, but allocates bits differently, resulting in a different representable range. (NS)Decimal stores a significand of up to 38 digits long and an exponent from -128 to 127, while this type stores up to 34 digits of significand and an exponent from -6143 to 6144.

    See more

    Declaration

    Objective-C

    @interface RLMDecimal128 : NSObject
  • A client for the email/password authentication provider which can be used to obtain a credential for logging in, and to perform requests specifically related to the email/password provider.

    See more

    Declaration

    Objective-C

    @interface RLMEmailPasswordAuth : RLMProviderClient
  • RLMEmbeddedObject is a base class used to define Realm model objects.

    Embedded objects work similarly to normal objects, but are owned by a single parent Object (which itself may be embedded). Unlike normal top-level objects, embedded objects cannot be directly created in or added to a Realm. Instead, they can only be created as part of a parent object, or by assigning an unmanaged object to a parent object’s property. Embedded objects are automatically deleted when the parent object is deleted or when the parent is modified to no longer point at the embedded object, either by reassigning an RLMObject property or by removing the embedded object from the array containing it.

    Embedded objects can only ever have a single parent object which links to them, and attempting to link to an existing managed embedded object will throw an exception.

    The property types supported on RLMEmbeddedObject are the same as for RLMObject, except for that embedded objects cannot link to top-level objects, so RLMObject and RLMArray<RLMObject> properties are not supported (RLMEmbeddedObject and RLMArray<RLMEmbeddedObject> are).

    Embedded objects cannot have primary keys or indexed properties.

    See more

    Declaration

    Objective-C

    @interface RLMEmbeddedObject : RLMObjectBase <RLMThreadConfined>
  • Options to use when executing a findOneAndUpdate, findOneAndReplace, or findOneAndDelete command on a RLMMongoCollection.

    See more

    Declaration

    Objective-C

    @interface RLMFindOneAndModifyOptions : NSObject
  • Options to use when executing a find command on a RLMMongoCollection.

    See more

    Declaration

    Objective-C

    @interface RLMFindOptions : NSObject
  • RLMMigration instances encapsulate information intended to facilitate a schema migration.

    A RLMMigration instance is passed into a user-defined RLMMigrationBlock block when updating the version of a Realm. This instance provides access to the old and new database schemas, the objects in the Realm, and provides functionality for modifying the Realm during the migration.

    See more

    Declaration

    Objective-C

    @interface RLMMigration : NSObject
  • The RLMMongoClient enables reading and writing on a MongoDB database via the Realm Cloud service.

    It provides access to instances of RLMMongoDatabase, which in turn provide access to specific RLMMongoCollections that hold your data.

    Note

    Before you can read or write data, a user must log in.

    See more

    Declaration

    Objective-C

    @interface RLMMongoClient : NSObject
  • Acts as a middleman and processes events with WatchStream

    See more

    Declaration

    Objective-C

    @interface RLMChangeStream : NSObject <RLMEventDelegate>
  • The RLMMongoCollection represents a MongoDB collection.

    You can get an instance from a RLMMongoDatabase.

    Create, read, update, and delete methods are available.

    Operations against the Realm Cloud server are performed asynchronously.

    Note

    Before you can read or write data, a user must log in.
    • Usage: RLMMongoClient *client = [self.app mongoClient:@“mongodb1”]; RLMMongoDatabase *database = [client databaseWithName:@“test_data”]; RLMMongoCollection *collection = [database collectionWithName:@“Dog”]; [collection insertOneDocument:@{@“name”: @“fido”, @“breed”: @“cane corso”} completion:…];

    See more

    Declaration

    Objective-C

    @interface RLMMongoCollection : NSObject
  • The RLMMongoDatabase represents a MongoDB database, which holds a group of collections that contain your data.

    It can be retrieved from the RLMMongoClient.

    Use it to get RLMMongoCollections for reading and writing data.

    Note

    Before you can read or write data, a user must log in`.

    See more

    Declaration

    Objective-C

    @interface RLMMongoDatabase : NSObject
  • An HTTP request that can be made to an arbitrary server.

    See more

    Declaration

    Objective-C

    @interface RLMRequest : NSObject
  • The contents of an HTTP response.

    See more

    Declaration

    Objective-C

    @interface RLMResponse : NSObject
  • Transporting protocol for foreign interfaces. Allows for custom request/response handling.

    See more

    Declaration

    Objective-C

    @interface RLMNetworkTransport : NSObject <RLMNetworkTransport>
  • RLMObject is a base class for model objects representing data stored in Realms.

    Define your model classes by subclassing RLMObject and adding properties to be managed. Then instantiate and use your custom subclasses instead of using the RLMObject class directly.

    // Dog.h
    @interface Dog : RLMObject
    @property NSString *name;
    @property BOOL      adopted;
    @end
    
    // Dog.m
    @implementation Dog
    @end //none needed
    

    Supported property types

    • NSString
    • NSInteger, int, long, float, and double
    • BOOL or bool
    • NSDate
    • NSData
    • NSNumber<X>, where X is one of RLMInt, RLMFloat, RLMDouble or RLMBool, for optional number properties
    • RLMObject subclasses, to model many-to-one relationships.
    • RLMArray<X>, where X is an RLMObject subclass, to model many-to-many relationships.

    Querying

    You can initiate queries directly via the class methods: allObjects, objectsWhere:, and objectsWithPredicate:. These methods allow you to easily query a custom subclass for instances of that class in the default Realm.

    To search in a Realm other than the default Realm, use the allObjectsInRealm:, objectsInRealm:where:, and objectsInRealm:withPredicate: class methods.

    See

    RLMRealm

    Relationships

    See our Cocoa guide for more details.

    Key-Value Observing

    All RLMObject properties (including properties you create in subclasses) are Key-Value Observing compliant, except for realm and objectSchema.

    Keep the following tips in mind when observing Realm objects:

    1. Unlike NSMutableArray properties, RLMArray properties do not require using the proxy object returned from -mutableArrayValueForKey:, or defining KVC mutation methods on the containing class. You can simply call methods on the RLMArray directly; any changes will be automatically observed by the containing object.
    2. Unmanaged RLMObject instances cannot be added to a Realm while they have any observed properties.
    3. Modifying managed RLMObjects within -observeValueForKeyPath:ofObject:change:context: is not recommended. Properties may change even when the Realm is not in a write transaction (for example, when -[RLMRealm refresh] is called after changes are made on a different thread), and notifications sent prior to the change being applied (when NSKeyValueObservingOptionPrior is used) may be sent at times when you cannot begin a write transaction.
    See more

    Declaration

    Objective-C

    @interface RLMObject : RLMObjectBase <RLMThreadConfined>
  • Information about a specific property which changed in an RLMObject change notification.

    See more

    Declaration

    Objective-C

    @interface RLMPropertyChange : NSObject
  • A 12-byte (probably) unique object identifier.

    ObjectIds are similar to a GUID or a UUID, and can be used to uniquely identify objects without a centralized ID generator. An ObjectID consists of:

    1. A 4 byte timestamp measuring the creation time of the ObjectId in seconds since the Unix epoch.
    2. A 5 byte random value
    3. A 3 byte counter, initialized to a random value.

    ObjectIds are intended to be fast to generate. Sorting by an ObjectId field will typically result in the objects being sorted in creation order.

    See more

    Declaration

    Objective-C

    @interface RLMObjectId : NSObject
  • This class represents Realm model object schemas.

    When using Realm, RLMObjectSchema instances allow performing migrations and introspecting the database’s schema.

    Object schemas map to tables in the core database.

    See more

    Declaration

    Objective-C

    @interface RLMObjectSchema : NSObject <NSCopying>
  • RLMProperty instances represent properties managed by a Realm in the context of an object schema. Such properties may be persisted to a Realm file or computed from other data from the Realm.

    When using Realm, RLMProperty instances allow performing migrations and introspecting the database’s schema.

    These property instances map to columns in the core database.

    See more

    Declaration

    Objective-C

    @interface RLMProperty : NSObject
  • An RLMPropertyDescriptor instance represents a specific property on a given class.

    See more

    Declaration

    Objective-C

    @interface RLMPropertyDescriptor : NSObject
  • Base provider client interface.

    See more

    Declaration

    Objective-C

    @interface RLMProviderClient : NSObject
  • A client which can be used to register devices with the server to receive push notificatons

    See more

    Declaration

    Objective-C

    @interface RLMPushClient : NSObject
  • An RLMRealm instance (also referred to as “a Realm”) represents a Realm database.

    Realms can either be stored on disk (see +[RLMRealm realmWithURL:]) or in memory (see RLMRealmConfiguration).

    RLMRealm instances are cached internally, and constructing equivalent RLMRealm objects (for example, by using the same path or identifier) multiple times on a single thread within a single iteration of the run loop will normally return the same RLMRealm object.

    If you specifically want to ensure an RLMRealm instance is destroyed (for example, if you wish to open a Realm, check some property, and then possibly delete the Realm file and re-open it), place the code which uses the Realm within an @autoreleasepool {} and ensure you have no other strong references to it.

    Warning

    Non-frozen RLMRealm instances are thread-confined and cannot be shared across threads or dispatch queues. Trying to do so will cause an exception to be thrown. You must call this method on each thread you want to interact with the Realm on. For dispatch queues, this means that you must call it in each block which is dispatched, as a queue is not guaranteed to run all of its blocks on the same thread.
    See more

    Declaration

    Objective-C

    @interface RLMRealm : NSObject
  • A token which is returned from methods which subscribe to changes to a Realm.

    Change subscriptions in Realm return an RLMNotificationToken instance, which can be used to unsubscribe from the changes. You must store a strong reference to the token for as long as you want to continue to receive notifications. When you wish to stop, call the -invalidate method. Notifications are also stopped if the token is deallocated.

    See more

    Declaration

    Objective-C

    @interface RLMNotificationToken : NSObject
  • An RLMRealmConfiguration instance describes the different options used to create an instance of a Realm.

    RLMRealmConfiguration instances are just plain NSObjects. Unlike RLMRealms and RLMObjects, they can be freely shared between threads as long as you do not mutate them.

    Creating configuration objects for class subsets (by setting the objectClasses property) can be expensive. Because of this, you will normally want to cache and reuse a single configuration object for each distinct configuration rather than creating a new object each time you open a Realm.

    See more

    Declaration

    Objective-C

    @interface RLMRealmConfiguration : NSObject <NSCopying>
  • RLMResults is an auto-updating container type in Realm returned from object queries. It represents the results of the query in the form of a collection of objects.

    RLMResults can be queried using the same predicates as RLMObject and RLMArray, and you can chain queries to further filter results.

    RLMResults always reflect the current state of the Realm on the current thread, including during write transactions on the current thread. The one exception to this is when using for...in fast enumeration, which will always enumerate over the objects which matched the query when the enumeration is begun, even if some of them are deleted or modified to be excluded by the filter during the enumeration.

    RLMResults are lazily evaluated the first time they are accessed; they only run queries when the result of the query is requested. This means that chaining several temporary RLMResults to sort and filter your data does not perform any extra work processing the intermediate state.

    Once the results have been evaluated or a notification block has been added, the results are eagerly kept up-to-date, with the work done to keep them up-to-date done on a background thread whenever possible.

    RLMResults cannot be directly instantiated.

    See more

    Declaration

    Objective-C

    @interface RLMResults<RLMObjectType>
        : NSObject <RLMCollection, NSFastEnumeration>
  • RLMLinkingObjects is an auto-updating container type. It represents a collection of objects that link to its parent object.

    For more information, please see the “Inverse Relationships” section in the documentation.

    Declaration

    Objective-C

    @interface RLMLinkingObjects<RLMObjectType : RLMObject *> : RLMResults
  • RLMSchema instances represent collections of model object schemas managed by a Realm.

    When using Realm, RLMSchema instances allow performing migrations and introspecting the database’s schema.

    Schemas map to collections of tables in the core database.

    See more

    Declaration

    Objective-C

    @interface RLMSchema : NSObject <NSCopying>
  • A configuration object representing configuration state for a Realm which is intended to sync with a Realm Object Server.

    See more

    Declaration

    Objective-C

    @interface RLMSyncConfiguration : NSObject
  • A singleton manager which serves as a central point for sync-related configuration.

    See more

    Declaration

    Objective-C

    @interface RLMSyncManager : NSObject
  • Options for configuring timeouts and intervals in the sync client.

    See more

    Declaration

    Objective-C

    @interface RLMSyncTimeoutOptions : NSObject
  • A token object corresponding to a progress notification block on a session object.

    To stop notifications manually, call -invalidate on it. Notifications should be stopped before the token goes out of scope or is destroyed.

    Declaration

    Objective-C

    @interface RLMProgressNotificationToken : RLMNotificationToken
  • An object encapsulating a MongoDB Realm “session”. Sessions represent the communication between the client (and a local Realm file on disk), and the server (and a remote Realm with a given partition value stored on MongoDB Realm).

    Sessions are always created by the SDK and vended out through various APIs. The lifespans of sessions associated with Realms are managed automatically. Session objects can be accessed from any thread.

    See more

    Declaration

    Objective-C

    @interface RLMSyncSession : NSObject

Error action token

  • An opaque token returned as part of certain errors. It can be passed into certain APIs to perform certain actions.

    See

    RLMSyncErrorClientResetError, RLMSyncErrorPermissionDeniedError

    Declaration

    Objective-C

    @interface RLMSyncErrorActionToken : NSObject
  • A task object which can be used to observe or cancel an async open.

    When a synchronized Realm is opened asynchronously, the latest state of the Realm is downloaded from the server before the completion callback is invoked. This task object can be used to observe the state of the download or to cancel it. This should be used instead of trying to observe the download via the sync session as the sync session itself is created asynchronously, and may not exist yet when -[RLMRealm asyncOpenWithConfiguration:completion:] returns.

    See more

    Declaration

    Objective-C

    @interface RLMAsyncOpenTask : NSObject
  • An object intended to be passed between threads containing a thread-safe reference to its thread-confined object.

    To resolve a thread-safe reference on a target Realm on a different thread, pass to -[RLMRealm resolveThreadSafeReference:].

    Warning

    A RLMThreadSafeReference object must be resolved at most once. Failing to resolve a RLMThreadSafeReference will result in the source version of the Realm being pinned until the reference is deallocated.

    Note

    Prefer short-lived RLMThreadSafeReferences as the data for the version of the source Realm will be retained until all references have been resolved or deallocated.

    See more

    Declaration

    Objective-C

    @interface RLMThreadSafeReference<__covariant Confined : id <RLMThreadConfined>>
        : NSObject
  • The result of an updateOne or updateMany operation a RLMMongoCollection.

    See more

    Declaration

    Objective-C

    @interface RLMUpdateResult : NSObject
  • A RLMUser instance represents a single Realm App user account.

    A user may have one or more credentials associated with it. These credentials uniquely identify the user to the authentication provider, and are used to sign into a MongoDB Realm user account.

    Note that user objects are only vended out via SDK APIs, and cannot be directly initialized. User objects can be accessed from any thread.

    See more

    Declaration

    Objective-C

    @interface RLMUser : NSObject

User info classes

  • An identity of a user. A user can have multiple identities, usually associated with multiple providers. Note this is different from a user’s unique identifier string. @seeAlso RLMUser.identifier

    See more

    Declaration

    Objective-C

    @interface RLMUserIdentity : NSObject
  • UserAPIKey model for APIKeys recevied from the server.

    See more

    Declaration

    Objective-C

    @interface RLMUserAPIKey : NSObject