I want to do a sub-array selection Python-like (ArraySlice
) in Swift.
This is working for me, but I know it's not nice. To make it work I used .suffix
embedded to .prefix
method. I'm wondering if there's an easier or cleaner method to accomplish this:
let startIndex = 3
let endIndex = 7
let newPoints = Array(points.suffix(points.count - startIndex).prefix(endIndex - startIndex + 1))