From b835f849e19c1aa2d4a4dbc6d5dfdb2a8a2f1185 Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Fri, 13 Apr 2018 14:10:55 +0200 Subject: [PATCH] Fixed invalid call of `NSManagedObject.fetchRequest()` Calling `NSManagedObject.fetchRequest()` is invalid: > This method is only legal to call on **subclasses of `NSManagedObject`** that represent a single entity in the model. https://developer.apple.com/documentation/coredata/nsmanagedobject/1640605-fetchrequest --- templates/machine.swift.motemplate | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/templates/machine.swift.motemplate b/templates/machine.swift.motemplate index 229ab325..20010154 100644 --- a/templates/machine.swift.motemplate +++ b/templates/machine.swift.motemplate @@ -47,11 +47,7 @@ open class _<$sanitizedManagedObjectClassName$>: NSManagedObject { @nonobjc open class func fetchRequest() -> NSFetchRequest<<$sanitizedManagedObjectClassName$>> { - if #available(iOS 10.0, tvOS 10.0, watchOS 3.0, macOS 10.12, *) { - return NSManagedObject.fetchRequest() as! NSFetchRequest<<$sanitizedManagedObjectClassName$>> - } else { - return NSFetchRequest(entityName: self.entityName()) - } + return NSFetchRequest(entityName: self.entityName()) } // MARK: - Life cycle methods