在ObjC类

时间:2017-04-25 10:29:29

标签: ios objective-c iphone swift

Swift Class:

@objc public class XyzClass: NSObject {

    var newlyVar = String()
    func abcd (abc:String?, name:Int) {

    }
    func mymethod(userId:Int32?,startIndex:Int32?, lastIndex:Int32?, m_bankId:Int32?, m_DownPayment:Int32?,m_maxTenure:Int32?, m_salary:Int32?) {

    } 

    func sampleMethod (userId:Int32,startIndex:Int32, lastIndex:Int32, m_bankId:Int32, m_DownPayment:Int32, m_maxTenure:Int32, m_salary:Int32, m_selfemployed:Int32, m_UAENational:Int32, complitionHandler: ( _ success:Bool, _ loans:[Loan]) -> Void){
            complitionHandler(true,[])
    }
}

在ObjC课程中,我访问为:

LoanParser *lp = [[LoanParser alloc]init];
[lp abcdWithAbc:@"" name:32];

方法abcd和变量newlyVar可供访问,但mymethodsampleMethod不是。

我在这里缺少什么?

关注我认为:Loan类符合Mappable协议

1 个答案:

答案 0 :(得分:2)

Int32?无法在Objective-C中表示。尝试将其更改为Int32

String可以表示为可选的,因为它转换为NSString对象,该对象可以为nil,因此桥接有一种表示无值的方法。