I have a generic method in one of my classes where I want to have a generic type corresponding to UIViewController and UIPickerViewDelegate . How can i do this? I thought about it:
func foo<T: UIViewController, UIPickerViewDelegate> (#viewController: T) {}
But this code does not recognize UIPickerViewDelegate . I also thought of using a handset | instead of a comma, but it's even worse, the compiler does not accept this. Is it possible to do this or do I need to make 2 parameters for the class and protocol? Or is there a more convenient solution?
Thanks for your help and Merry Christmas:]
source share