Swift 3 Core Data Delete Object
<p>Unfortunately the new Core Data semantics make me crazy. My previous question had a clean code that didn't work because of incorrect auto generation of header files. Now I continue my work with deleting objects. 
My code seems to be very simple: </p>

<pre><code>func deleteProfile(withID: Int) {
    let fetchRequest: NSFetchRequest&lt;Profile&gt; = Profile.fetchRequest()
    fetchRequest.predicate = Predicate.init(format: "profileID==\(withID)")
    let object = try! context.fetch(fetchRequest)
    context.delete(object)
} 
</code></pre>

<p>I did a "hard" debug with <code>print(object)</code> instead of <code>context.delete(object)</code> and it showed me the right object.
So I need just to delete it.</p>

<p>P.S. there is no <code>deleteObject</code>. Now NSManagedContext has only <code>public func delete(_ sender: AnyObject?)</code></p>