1
매개 변수를 두 가지 유형으로 가질 수있는 방법이 있다면 누구나 알 수 있습니까? 이러한 기능에 대한 같은스위프트 3 매개 변수 : 단일 변수, 두 가지 유형
:
func email(from viewcontroller : (UIViewController, MFMailComposeViewControllerDelegate) {
}
매개 변수를 두 가지 유형으로 가질 수있는 방법이 있다면 누구나 알 수 있습니까? 이러한 기능에 대한 같은스위프트 3 매개 변수 : 단일 변수, 두 가지 유형
:
func email(from viewcontroller : (UIViewController, MFMailComposeViewControllerDelegate) {
}
Genericize 함수의 정의 :
func email<T>(from viewController : T) where T: UIViewController, T: MFMailComposeViewControllerDelegate {
// ...
}
당신이 모두 UIViewController''에서 상속 유형을 수용하고 준수하기 위해'viewcontroller' 매개 변수를 찾고 계십니까 'MFMailComposeViewControllerDelegate'? 그렇다면 [Swift : type이 프로토콜을 구현하고 해당 클래스의 하위 클래스 여야 함] (http://stackoverflow.com/q/25825988/2976878)을 참조하십시오. – Hamish