How to use a Fetch request from xcdatamodeld?
Bharath's answer is for how to create and execute a fetch request in code. This is commonly how you'll do it. However, it's not actually the answer to your question. If you actually create a fetch request named "allCategories" in the core data model like that, this is how you use it:
let fetchRequest = self.managedObjectModel.fetchRequestTemplate(forName: "allCategories")
let fetchedObjects = self.managedObjectContext.execute(fetchRequest!)