This is actually not an answer, but too long for a comment:
I understand the following:
The cloud function loadData returns success , which is an array of dictionaries or, possibly, in case of an error, nil . If nil returns, you do nothing.
If the array is returned, it is called objects .
Then this array is mapped to an array of elements of type MyData .
For each item returned from a cloud function called object , an instance of MyData is created using the dataSource new PFObject instance of the MyData class and the properties specified by the dictionary object.
I do not understand the following statement, according to which you assign the objectId object returned from the cloud function to the newly created PFObject : as far as I know, objectIds must be unique and cannot (or at least should not) be assigned to other PFObjects .
But you said that you need to do this or else you will get one element in the result set (see below).
Anyway, now you have an array of MyData instances in the dataTable .
Then you initialize the dataSet , which is not required since it will be overwritten anyway with your last expression.
This statement creates a collection of dataTable .
Now, when you get one element in this set, if you do not set the objectId property of the elements of the dataTable array, this means that all elements of this array are the same object. That means your init function
MyData(dataSource: PFObject(className: "MyData", dictionary: object))
always returns the same object, and this object is created by another, setting its property objectId . This is very strange for me. Please check what happens there.
Now, if you call loadData again to update the data, the cloud function will probably return some or all of the previous objects again. In this case, you assigned the old objectId , which was already assigned earlier by PFObject , created in the map function, to another PFObject created there, which is not allowed, therefore an error message.
Shorten this:
If the same object is repeatedly returned from a cloud function, you should not create different PFObjects for them and assign them the same objectId .
Hope this helps!