SWIFT 中 class 协议错误的#selector

#selector for class protocole error in SWIFT

我需要一些 UIWebViewDelegate 的选择器 在 objective-C 中,我们是这样得到的: 这是一个包含 1 个以上参数的示例:

@selector(webView:shouldStartLoadWithRequest:navigationType:)

这是一个只有一个参数的例子:

@selector(webViewDidStartLoad:)

如何在swift中获取? , 如何将相同的代码翻译成 swift?

解决方案是这样的

具有多个参数的方法的选择器

在Objective-C中:

@selector(webView:shouldStartLoadWithRequest:navigationType:)

在Swift中:

#selector(UIWebViewDelegate.webView(_:shouldStartLoadWithRequest:navigationType:))

具有一个参数的方法选择器

在Objective-C中:

@selector(webViewDidStartLoad:)

在Swift中:

#selector(UIWebViewDelegate.webViewDidStartLoad(_:))