Here's the code:
 func setupData() {
    clearData()
    let delegate = UIApplication.shared.delegate as? AppDelegate
    if let context = delegate?.persistentContainer.viewContext {
        let mark = NSEntityDescription.insertNewObject(forEntityName: "Friend", into: context) as! Friend
        mark.name = "Vuyo Nkabinde"
        mark.profileImageName = "zuckprofile"
        let message = NSEntityDescription.insertNewObject(forEntityName: "Message", into: context) as! Message
        message.friend = mark
        message.text = "Hello, my name is Mark. Nice to meet you..."
        message.date = NSDate()
        let steve = NSEntityDescription.insertNewObject(forEntityName: "Friend", into: context) as! Friend
        steve.name = "Steve Jobs"
        steve.profileImageName = "steve_profile"
        let messagesSteve = NSEntityDescription.insertNewObject(forEntityName: "Message", into: context) as! Message
        messagesSteve.friend = steve
        messagesSteve.text = "Code is the most innovative company I have ever seen..."
        messagesSteve.date = NSDate()
        do {
        try(context.save())
        } catch let err {
            print(err)
        }
    }
My issue is with the  let mark = NSEntityDescription.insertNewObject(forEntityName: "Friend", into: context) as! Friend line, it was written in swift 2 and I changed all the code to swift 3 but this particular line gives me a signal SIGABRT error.