The error message is misleading. The problem is that toPlotLines[0 ..< n]
is not an Array
but an ArraySlice:
The Array-like type that represents a sub-sequence of any Array, ContiguousArray, or other ArraySlice.
To create a "real array", use
graphView.graphPoints = Array(toPlotLines[0 ..< n])