2017-04-25 31 views
2

夫特類別:訪問參數化在ObjC類迅速方法

@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 ISN 「T。

我在這裏失蹤的任何東西?

關注感覺是:Loan類符合Mappable協議

回答

2

Int32?不能在Objective-C來表示。嘗試將其更改爲Int32

可以將字符串表示爲可選字符串,因爲它將轉換爲可以爲零的NSString對象,所以橋接方法可以表示無值。

+1

是有意義的。 ty buddy – preetam

+0

更新的問題,增加了一個方法與completionhandler。請看看 – preetam

+0

我沒有問題從ObjC訪問你的'sampleMethod'。雖然你拼寫完成錯了。 – Oskar