Search code examples
iosswiftparse-platformios8pfuser

Create a relationship between a PFUser and an Object in Swift


I have two classes in Parse

  1. User
  2. WorkoutClasses

The workout classes is a list of objects that describe a class the PFUser can subscribe to. How would I structure the data in swift so that in one view controller you, the 'Current User', can create a relation to that class, and then in another table view controller it will display the objects in the WorkoutClasses class that you have a relation to. Also, how would I delete the user relation with that object?


Solution

  • Use a parse relationship, from the User to the WorkoutClasses (though in parse that class should be called WorkoutClass).

    In one VC you will display all WorkoutClasss and add items to the relationship. In the other VC you will query the relationship to display the items and you can remove from the relationship.