Anyone know if there's a way to have a parameter be of two types?
Such as for the function:
func email(from viewcontroller : (UIViewController, MFMailComposeViewControllerDelegate) {
}
Anyone know if there's a way to have a parameter be of two types?
Such as for the function:
func email(from viewcontroller : (UIViewController, MFMailComposeViewControllerDelegate) {
}
Genericize your function's definition:
func email<T>(from viewController : T) where T: UIViewController, T: MFMailComposeViewControllerDelegate {
// ...
}
In Swift 4
func email(from viewcontroller : UIViewController & MFMailComposeViewControllerDelegate) {
}
Elegant, short and intuitive.