What i do was:
import Foundation
extension RandomAccessCollection {
func get(at i: Int) -> Element? {
guard i >= 0, i < count else {
return nil
}
// calculate the collection's index by offsetting from the start index
let collectionIndex = index(startIndex, offsetBy: i)
return self[collectionIndex]
}
}
What do you think?
Thanks.
Post
Replies
Boosts
Views
Activity
This code is near mine. The problem is that Xcode16 don't know what is "Index" and "indices".
+1 on Fix
https://github.com/utmapp/UTM/issues/5780