相关疑难解决方法(0)

在Swift中实现Objective c协议

我在一个客观的c类中有这个协议:

@protocol YTManagerDelegate <NSObject>
@required
- (void)uploadProgressPercentage:(int)percentage;
@end
...
Run Code Online (Sandbox Code Playgroud)

和一个与之相关的快速课程:

class YTShare: UIViewController, YTManagerDelegate{

    func uploadProgressPercentage(percentage:Int?){
        println(percentage)
    }
    ...
Run Code Online (Sandbox Code Playgroud)

我收到错误:类型YTShare不符合协议YTShareDelegate,我可能错误地写了swift函数,所以obj类没有找到它.我怎么写得正确?

protocols objective-c swift

6
推荐指数
1
解决办法
4710
查看次数

标签 统计

objective-c ×1

protocols ×1

swift ×1