I'd like to create an extension function on 'Array' that inserts an array at the index provided.
mutating func insert<T>( array: [T], atIndex index: Int ) {
var floatingIndex = index
for (index, value) in enumerate(array) {
self.insert(value, atIndex: floatingIndex)
floatingIndex++
}
}
Something like this, but I get an error saying I can't invoke 'insert(...)' with an argument of type (T, atIndex: Int).
Is there a way I can insert a generic into an array?