Supprimer les Données de Coredata Swift

Dans mon tableViewController j'ai le texte suivant. Et je suis d'essayer d'obtenir la suppression d'un élément de travail.

var myData: Array<AnyObject> = []

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cellID: NSString = "Cell"
    var Cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellID) as UITableViewCell
    var data: NSManagedObject = myData[indexPath.row] as NSManagedObject
    Cell.textLabel?.text = data.valueForKeyPath("Name") as? String

    return Cell
}

D'essayer et de supprimer ce que j'ai.

override func tableView(tableView: (UITableView!), commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
    if editingStyle == .Delete {
        let cellID: NSString = "Cell"
        var Cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellID) as UITableViewCell
        var data: NSManagedObject = myData[indexPath.row] as NSManagedObject
        data.delete(0)

        //Delete the row from the data source
        //tableView!.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)


    } else if editingStyle == .Insert {
        //Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }
}
InformationsquelleAutor MwcsMac | 2014-09-25