所以我有这个用Objective-C编写的委托函数,但是我把这个类桥接到了swift,无法弄清楚如何在Swift中声明它。
- (void)attributedLabel:(NIAttributedLabel *)attributedLabel
didSelectTextCheckingResult:(NSTextCheckingResult *)result atPoint:(CGPoint)point;
这是我尝试使用失败的当前功能:
func didSelectTextCheckingResult(result:NSTextCheckingResult, atPoint point:CGPoint) {
//[[UIApplication sharedApplication] openURL:result.URL];
}
答案 0 :(得分:1)
如果Objective-C需要这种方法:
- (void)attributedLabel:(NIAttributedLabel *)attributedLabel
didSelectTextCheckingResult:(NSTextCheckingResult *) result
atPoint:(CGPoint)point;
......那么Swift的等价物肯定是:
func attributedLabel(attributedLabel: NIAttributedLabel,
didSelectTextCheckingResult result: NSTextCheckingResult,
atPoint point: CGPoint) {
// ...
}