vendredi 9 janvier 2015

How to write this codes in swift?


Vote count:

0




a Swift APP using an OBJ-C class, the example in OBJ-C like below:



d1.getData = ^(NSUInteger item) {
float x = [vals[item] floatValue];
float y = [vals2[item] floatValue];
NSString *label1 = [NSString stringWithFormat:@"%d", item];
NSString *label2 = [NSString stringWithFormat:@"%f", y];
return [LineChartDataItem dataItemWithX:x y:y xLabel:label1 dataLabel:label2];
};


can't get any idea to deal with d1.getData = ^(NSUInteger item) in Swift!


Addition, at the head of the class:



typedef LineChartDataItem *(^LineChartDataGetter)(NSUInteger item);
@property (copy) LineChartDataGetter getData;


Any help? Thanks.



asked 41 secs ago







How to write this codes in swift?

Aucun commentaire:

Enregistrer un commentaire