How to programmatically grant a user reader access to a Realm? (Swift iOS)



I’m attempting to grant a user read access to an existing Realm.

The trouble I’m having is figuring out how to get the identity of the target user. I know the email address of the target user but I don’t know how to look up the user to retrieve the identity property.

let permission = SyncPermission(
                realmPath: realmPath,  // The remote Realm path on which to apply the changes
                identity: otherUserID, // The user ID for which these permission changes should be applied
                accessLevel: .read
            )   // The access level to be granted


@anonymous9 You can use RLMSyncPermission and pass in the email:


You can also use the retrieve account method: