I got this error after using BidirectionalCollection:
Referencing property 'last' on 'ChunkedByCount' requires that 'Self' conform to 'RandomAccessCollection'
So I change to RandomAccessCollection and it works now. Why is it want RandomAccessCollection and BidirectionalCollection is not good enough?
Can the compiler give guidance to my original problem:
“You want to use .last? Upgrade to RandomAccessCollection”