Support for the NSManagedObject fetchRequest () class method in iOS 9 and 10

In iOS 10, a new class-level fetchRequest() method was introduced in NSManagedObject .

Like many other developers, I created my own extension on NSManagedObject , which had a fetchRequest() method.

Now the compiler complains about this when I try to create support for IOS 10 (with the goal of deploying 9.0).

What is not a scary way (that is, I do not rename the method and all call points) to continue to support iOS 9 and 10 using this code base?

Currently, the extension is as follows:

 extension NSManagedObject { static func fetchRequest() -> NSFetchRequest { return NSFetchRequest(entityName: self._entityName()) } } 
+2
source share

Source: https://habr.com/ru/post/1266360/


All Articles