Swift 和 Objective C 委托调用 - 数据类型问题

Swift and Objective C Delegate calling - Data type issue

我尝试在 Objective C 中使用 Swift class 并让 Objective C class "GameScene" 接收来自 swift class。但是在 swift class 中,我收到错误消息“无法使用 '(int, col:int)'

类型的参数列表调用 drawTopEdge
    //above in the code
    var maze:[[Int]]!
////////////////
     func display() { //this is in the swift class
        for i in 0..<y {
            // Draw top edge
            for j in 0..<x {
                print((maze[j][i] & 1) == 0 ? "+---" : "+   ")
                if ((maze[j][i] & 1) == 0) {
                   delegate!.drawTopEdge(j, col: i) //Error see picture attached and above
                }
            }


    //This is in the GameScene class
    -(void)drawTopEdge:(NSUInteger)r col:(int)c; 
    -(void)drawLeftEdge:(NSUInteger)r col:(int)c;
    -(void)drawBottomEdge:(NSUInteger)r col:(int)c;

http://i.stack.imgur.com/dVLEe.png

-(void)drawTopEdge:(NSUInteger)r col:(int)c; 

NSUInteger 在 Swift 中变为 Int。但是,int 变成了 CInt。理想情况下,您应该更改签名以使用基于 NS* 的整数,以便 Swift 可以轻松桥接它们。但除此之外,您可以在调用点投射:

delegate!.drawTopEdge(j, col: CInt(i))

有关更多信息,请参阅 Dealing with C APIs and Foundation Data Types