I have the following swift class with a NumericType T.
@objc class MathStatistics<T: NumericType> : NSObject {
var numbers = [T]()
func sum() -> T? {
if numbers.count == 0 {
return nil
}
var sum = T(0)
for value in numbers {
sum = sum + value
}
return sum
}
}
In swift a initialize the class object as follows:
let statistics = MathStatistics<Double>()
How do I initialize the same object in Objective C? The following line does not set the numeric type T.
MathStatistics *stats = [[MathStatistics alloc] init];