I need to remove a range of elements from an array in Swift. Here is the javascript version of exactly what I need to do in Swift: Remove a range of elements from an array
javascript code: 'array.splice(start, deleteCount)'
I have tried to use the ".removeSubrange" instance but Xcode gives the following warning:
"Variable 'array1Adjusted' inferred to have type '()', which may be unexpected"
Here is my simple code:
var array1 = [10,20,30,40,50,60,70,80,90,100]
var array1Adjusted = array1.removeSubrange(5..<9)
And next I need to find the sum of all the elements of array1Adjusted...
var sumArray1Adjusted = array1Adjusted.reduce(0, +)
...but I get the following error:
"Value of tuple type '()' has no member 'reduce'"