Scene kit errors

Scene kit on OSX worked and I often used some code that I had compiled without any problems. But since the recent upgrade to High Sierra the same code now logs the run time error C3DMeshElementSetPrimitives invalid index buffer size. Recompling it makes no difference. I have no idea why this error is called but the simple shape is not rendered. What defines an invalid index buffer size? Can anyone shed any light on this?

         let byteSize = MemoryLayout<CInt>.size
        let indexSize = MemoryLayout<Data>.size
        indices = (NSMutableData(bytes: bytes, length:bytes.count * byteSize) as Data)
        source = SCNGeometryElement(data: indices , primitiveType: .triangles, primitiveCount: 2, bytesPerIndex: indexSize)



I have 2 Triangles with 6 Indices and 6 Coordinates…



indices = (NSMutableData(bytes: bytes, length:bytes.count * byteSize) as Data)
source = SCNGeometryElement(data: indices , primitiveType: .triangles, primitiveCount: 2, bytesPerIndex: byteSize)
Scene kit errors
 
 
Q