private var distance: Double {
return fabs(max - min)
}
如何用Objective C语言定义此变量。
答案 0 :(得分:2)
在您的.m文件中:
@interface MyClass ()
@property (nonatomic, assign, readonly) double distance;
@end
@implementation MyClass
-(double)distance {
return fabs(max - min);
}
@end