Navigation

Call a Function - iOS SDK

Consider a Realm function named sum that takes two arguments, adds them, and returns the result:

// sum: adds two numbers
exports = function(a, b) {
return a + b;
};

To execute a function from the iOS Client SDK, use the functions object on the currently logged-in user.

The functions object has dynamic members corresponding to functions. In this case, functions.sum() refers to the sum function. Pass a BSONArray of arguments. The trailing closure is the completion handler to call when the function call is complete. This handler is executed on a non-main global DispatchQueue.

Give Feedback

On this page

  • Call a Function by Name