Subclass.fetchRequest() Swift 3.0, extension not really helping 100%?

后端 未结 3 424
长发绾君心
长发绾君心 2021-01-03 18:05

according to the new Core Data changes, Xcode generates this subclass for me:

extension Person {

    @nonobjc public class func fetchRequest() -> NSFetch         


        
3条回答
  •  梦毁少年i
    2021-01-03 18:53

    The reason is the generic type. NSFetchRequest has been turned into a generic to avoid a lot of type casting.

    If the function doesn't take any parameter so the concrete type (Person) cannot be passed directly and the return type is also a generic it must be annotated explicitly.

提交回复
热议问题