Infer Generic Type in Class Method with Swift
问题 Is it possible for a generic method to infer its type based on the class in which it is being executed? I use CoreData NSManagedObject models to store and retrieve local data, and have managed to make everything generic in an easy to read and usable way, except for in one place. If a user wishes to query the local database to fetch a list of objects, he would write the following line: let posts: [Post] = Post.all() This will properly return "all" Post objects in the database, but the syntax