count is the number of items in the collection, whereas endIndex is the Index (from the Collection protocol) which is just past the end of the collection.
For Array, these are the same. For some other collections, such as ArraySlice, they are not:
let array = ["a", "b", "c", "d", "e"]
array.startIndex // 0
array.count // 5
array.endIndex // 5
let slice = array[1..<4] // elements are "b", "c", "d"
slice.startIndex // 1
slice.count // 3
slice.endIndex // 4