title: swift - How to check CoreData exists
body: <p>I am trying to check if the item exits in coredata if not add it to coredata. How am I going to implement the check?</p>
  <pre><code>var authorList = [AuthorList]()
      
  let articleEntity = NSEntityDescription.entityForName(&quot;AuthorList&quot;, inManagedObjectContext: self.context!)
  let newAuthor = AuthorList(entity: articleEntity!, insertIntoManagedObjectContext: self.context!)
       
  //if authorID is not in coredata then....
  newAuthor.authorName = authorName!
  newAuthor.authorImage = authorImage!
  newAuthor.newspaperName = newspaperName!
  newAuthor.newsPaperImage = newsPaperImage!
  newAuthor.authorID = authorID!
  </code></pre>