title: Core Data add relationship value
body: <p>I have two entities:</p>
  
  <pre><code>extension Meet {
  
      @NSManaged var meetAllAroundScore: NSNumber?
      @NSManaged var meetBarPlace: String?
      @NSManaged var meetBarScore: NSNumber?
      @NSManaged var meetBeamPlace: String?
      @NSManaged var meetBeamScore: NSNumber?
      @NSManaged var meetDate: String?
      @NSManaged var meetDateSort: String?
      @NSManaged var meetFloorPlace: String?
      @NSManaged var meetFloorScore: NSNumber?
      @NSManaged var meetLocation: String?
      @NSManaged var meetName: String?
      @NSManaged var meetStatus: String?
      @NSManaged var meetTime: String?
      @NSManaged var meetTimeSort: String?
      @NSManaged var teamPlace: String?
      @NSManaged var gymnasts: NSSet?
  
  }
  
  extension Gymnast {
  
      @NSManaged var age: NSNumber?
      @NSManaged var email: String?
      @NSManaged var firstName: String?
      @NSManaged var gender: String?
      @NSManaged var isActive: String?
      @NSManaged var lastName: String?
      @NSManaged var level: NSNumber?
      @NSManaged var picture: NSData?
      @NSManaged var telephone: String?
      @NSManaged var usag: String?
      @NSManaged var meets: NSSet?
  
  }
  </code></pre>
  
  <p>I posed this question before on how to set new meet to all gymnasts and was told I needed to add these extensions which I have done after changing relationship to many to many.</p>
  
  <pre><code>extension NSManagedObject {
      func addObject(value: NSManagedObject, forKey key: String) {
          let items = self.mutableSetValueForKey(key)
          items.addObject(value)
      }
  
      func removeObject(value: NSManagedObject, forKey key: String) {
          let items = self.mutableSetValueForKey(key)
          items.removeObject(value)
      }
  }
  </code></pre>
  
  <p>Can anyone point me to where I am going wrong?</p>
  
  <pre><code>if let meetname = meetNameText.text {
  
                  item.meetName = meetname
  
                  //let newMeet = meetNameText.text
                  let newMeet = item.gymnasts!.mutableCopy() as! NSMutableSet
                  let items = self.mutableSetValueForKey("gymnasts")
                  items.addObject(newMeet)
  </code></pre>