Get class name in convenience init Swift 3
问题 I'm trying to implement my own version of convenience init(context moc: NSManagedObjectContext) , the new convenience initialiser on NSManagedObject in iOS 10. Reason being I need to make it compatible with iOS 9. I've come up with this: convenience init(managedObjectContext moc: NSManagedObjectContext) { let name = "\(self)".components(separatedBy: ".").first ?? "" guard let entityDescription = NSEntityDescription.entity(forEntityName: name, in: moc) else { fatalError("Unable to create