title: Save Object in CoreData (Attributes with String, Double & Array)
body: <p>I am having difficulty with saving an object in CoreData.  It was working fine before but I changed three variables from a String to an Array of Strings...  image, imageDesc and attrib
  I have a file called CoreDataHandler as below.</p>
  
  <pre><code>class CoreDataHandler: NSObject {
  private class func getContext() -&gt; NSManagedObjectContext {
      let appDelegate = UIApplication.shared.delegate as! AppDelegate
  
      return appDelegate.persistentContainer.viewContext
  }
  class func saveObject(name: String, type: String, description: String, image: [String], imageDesc: [String], attrib: [String], rating: String, address: String, lat: Double, long: Double, annoName: String) -&gt; Bool {
      //cost: String, openingTimes: String, pets: String, 
      let context = getContext()
      let entity = NSEntityDescription.entity(forEntityName: "CastleSave", in: context)
      let manageObject = NSManagedObject(entity: entity!, insertInto: context)
  
      manageObject.setValue(name, forKey: "name")
      manageObject.setValue(type, forKey: "type")
      manageObject.setValue(description, forKey: "desc")
      manageObject.setValue([image], forKey: "image")
      manageObject.setValue([imageDesc], forKey: "imageDesc")
      manageObject.setValue([attrib], forKey: "attrib")
      manageObject.setValue(rating, forKey: "rating")
      manageObject.setValue(address, forKey: "address")
      manageObject.setValue(lat, forKey: "lat")
      manageObject.setValue(long, forKey: "long")
      manageObject.setValue(annoName, forKey: "annoName")
  
      do {
          try context.save()
          return true
      } catch {
          return false
      }
  }
  </code></pre>
  
  <p>I was using the below code for saving as a favourite</p>
  
  <pre><code>CoreDataHandler.saveObject(name: (txte?.name)!, type: (txte?.type)!, description: (txte?.description)!, image: (txte?.image)!, imageDesc: (txte?.imageDesc)!, attrib: (txte?.attrib)!, rating: (txte?.rating)!, address: (txte?.address)!, lat: (txte?.lat)!, long: (txte?.long)!, annoName: (txte?.annoName)!)
  </code></pre>
  
  <p>In my DataModel...
  I previously had the attributes of image, imageDesc &amp; attrib as String.<br>
  I changed this to Transformable, and the attribute CustomClass as [String] but I am struggling to see how I can save this correctly.</p>
  
  <p>Can anyone help please?</p>