I'm trying to extend an Array<Float> in Swift 3. The goal is to add a function and call a few self.append() statements in the body. Here's what I have so far:
extension Array where Element: FloatingPoint {
mutating func test(a: Float) {
self.append(a)
}
}
I'm getting an error that append() needs a FloatingPoint, and that it cannot use Float. But doesn't the Float type conform to FloatingPoint? Btw in Swift 2.X, I extended _ArrayType which worked well. It seems to have disappeared in Swift 3, and the append() function is now in Array.