Functions

The following functions are available globally.

  • Returns whether the two errors are identical

    Declaration

    Swift

    public func == (lhs: ErrorType, rhs: ErrorType) -> Bool { // swiftlint:disable:this valid_docs
  • Explicitly implement pattern matching for Realm.Error, so that the instances can be used in the do … syntax.

    Declaration

    Swift

    public func ~= (lhs: Error, rhs: ErrorType) -> Bool { // swiftlint:disable:this valid_docs
  • Get the schema version for a Realm at a given path. - parameter realmPath: Path to a Realm file. - parameter encryptionKey: Optional 64-byte encryption key for encrypted Realms. - parameter error: If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, omit the argument, or pass in nil.

    Declaration

    Swift

    public func schemaVersionAtPath(realmPath: String, encryptionKey: NSData? = nil,
                                    error: NSErrorPointer = nil) -> UInt64?

    Parameters

    realmPath

    Path to a Realm file.

    encryptionKey

    Optional 64-byte encryption key for encrypted Realms.

    error

    If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, omit the argument, or pass in nil.

    Return Value

    The version of the Realm at realmPath or nil if the version cannot be read.

  • Get the schema version for a Realm at a given local URL.

    Throws

    An NSError that describes the problem.

    Declaration

    Swift

    public func schemaVersionAtURL(fileURL: NSURL, encryptionKey: NSData? = nil) throws -> UInt64

    Parameters

    fileURL

    Local URL to a Realm file.

    encryptionKey

    Optional 64-byte encryption key for encrypted Realms.

    Return Value

    The version of the Realm at fileURL.

  • Performs the configuration’s migration block on the Realm created by the given configuration.

    This method is called automatically when opening a Realm for the first time and does not need to be called explicitly. You can choose to call this method to control exactly when and how migrations are performed.

    Declaration

    Swift

    public func migrateRealm(configuration: Realm.Configuration = Realm.Configuration.defaultConfiguration) -> NSError?

    Parameters

    configuration

    The Realm.Configuration used to create the Realm to be migrated, and containing the schema version and migration block used to perform the migration.

    Return Value

    nil if the migration was successful, or an NSError object that describes the problem that occurred otherwise.

  • Returns whether the two object schemas are equal.

    Declaration

    Swift

    public func == (lhs: ObjectSchema, rhs: ObjectSchema) -> Bool { // swiftlint:disable:this valid_docs
  • Returns whether the two properties are equal.

    Declaration

    Swift

    public func == (lhs: Property, rhs: Property) -> Bool { // swiftlint:disable:this valid_docs
  • Returns whether the two realms are equal.

    Declaration

    Swift

    public func == (lhs: Realm, rhs: Realm) -> Bool { // swiftlint:disable:this valid_docs
  • Returns whether the two schemas are equal.

    Declaration

    Swift

    public func == (lhs: Schema, rhs: Schema) -> Bool { // swiftlint:disable:this valid_docs
  • Returns whether the two sort descriptors are equal.

    Declaration

    Swift

    public func == (lhs: SortDescriptor, rhs: SortDescriptor) -> Bool