Я хочу, чтобы проверить, что UIViewController
соответствует протоколу моего собственного творчества:conformsToProtocol не будет компилировать с пользовательским протоколом
import UIKit
protocol myProtocol {
func myfunc()
}
class vc : UIViewController {
}
extension vc : myProtocol {
func myfunc() {
//My implementation for this class
}
}
//Not allowed
let result = vc.conformsToProtocol(myProtocol)
//Allowed
let appleResult = vc.conformsToProtocol(UITableViewDelegate)
Однако я получаю следующее сообщение об ошибке:
Cannot convert value of type '(myprotocol).Protocol' (aka 'myprotocol.Protocol') to expected argument type 'Protocol'
Что я делаю неправильно?
'@objc protocol myProtocol { func myfunc() }' –