How to add record to Reference List for Record Type using CloudKit?
<p>I have a two simple Record Types: <code>Artwork</code> and <code>Artist</code>. <code>Artwork</code> as a child may belong to <strong>one</strong> <code>Artist</code>, however one <code>Artist</code> may have multiply artworks.</p>

<p>Below are the screenshots related to mentioned Record Types.</p>

<p><a href="https://i.stack.imgur.com/21KJo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/21KJo.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/QusCv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QusCv.png" alt="enter image description here"></a></p>

<p>I can simply setup <code>artist</code> for <code>artwork</code> the following way:</p>

<pre><code>let artistID = CKRecordID(recordName: "F297D690-888B-4B55-9FBD-27CAEF4BBD83")
let artworkID = CKRecordID(recordName: self.idTextField.text!)

self.container.publicCloudDatabase.fetchRecordWithID(artworkID, completionHandler: { artwork, error in

    if let artwork = artwork {

        artwork["artist"] = CKReference(recordID: artistID, action: CKReferenceAction.None)
        self.container.publicCloudDatabase.saveRecord(artwork, completionHandler: { artwork, error in

             print("done")
        })
    }
})
</code></pre>

<p>But the question is:</p>

<p><strong>How to setup relationships in reversed relation? In other words how to add <code>artworkID</code> to the reference list of <code>artistID</code>?</strong></p>

<p>Apple says:</p>

<blockquote>
  <p>...to represent the one-to-many relationship from <code>Artist</code> to <code>Collection</code> in the object model, add a reference field to the <code>Collection</code> record.</p>
</blockquote>

<p>But how to do this?</p>