Passing generic Class as argument to function in swift
Below is my method in which there is fetch I make on a Managed object Class Appointment. I need to use same function for other similar managed object Classes. How do I pass different "Class" as parameter every time as I need. And also use it to fetch as I have currently "Appointment" Class. I might need to use Generics may be. Dont know how though. func getAppointmentArray(aPredicate : String , aModel : Any) -> [Any] { var apptArr = [Any]() let fetchRequest = NSFetchRequest<Appointment>(entityName: "Appointment") fetchRequest.returnsObjectsAsFaults = false fetchRequest.predicate = NSPredicate