I state that it is a few years that I have not programmed in Swift, some time ago I had created this extension to randomly access the elements of an array but I get the error "Cannot find type 'T' in scope"
extension Array {
func randomElement() -> T {
let index = Int(arc4random_uniform(UInt32(self.count)))
return self[index]
}
}
How could I solve? I also tried to put Array in it but I always get the same error