How to use CKReference in Swift

484 Views Asked by At

It seems that I have searched everywhere for a decent explanation of this topic. Apple docs are great for theory but lack sufficient documentation when it comes to connecting with code. I am looking to build the ever so popular User to Posts schema, and I am having trouble grasping what CKReference exactly does. An explanation of what occurs (behind the scenes if possible) and how to implement it in Swift would be great. Any guidance would be much appreciated.

The way I am currently thinking of it is a Reference to the Post record would be made where the User record is made. However this doesn't make sense as there would be no way to reference the Post record in the place the User record is being made (most often a signup page), where there are no posts. And since the schema is being created dynamically there wouldn't be any way to access the Post record theoretically even if you were to query the database.

Using Swift 3 and Xcode 8.

0

There are 0 best solutions below