title: Swift Array in CoreData
body: <p>I want to store an array with 28 entries to my coreData. Is there any way to do this?
  I tried it with this code but it looks like that this code is only rewriting the value.</p>
  
  <pre><code>let appDelegate =
          UIApplication.shared.delegate as! AppDelegate
  
      let managedContext = appDelegate.persistentContainer.viewContext
  
      let entity =  NSEntityDescription.entity(forEntityName: "PillTook",
                                               in:managedContext)
  
      let value = NSManagedObject(entity: entity!,
                                  insertInto: managedContext)
  
      for var index in 0...27 {
  
          value.setValue(false, forKey: "took")
  
          do {
              try managedContext.save()
  
              pillTook.append(value)
  
          } catch let error as NSError  {
              print("Could not save \(error), \(error.userInfo)")
          }
      }
  </code></pre>