The โproblemโ here is the statement guard let prime = numbers[i] . The compiler complains about this because the guard let syntax expects numbers[i] be optional, which it can conditionally expand. But this is not necessary, you can always extract the i-th Int from an array.
To fix it, just write
let prime = numbers[i] guard prime > 0 else { continue }
The proper use of stride then looks like this (after a long search in the comments):
for multiple in (2*prime-2).stride(to: n-2, by: 2*prime-2) {
Then the final part should change print :
print("\(numbers[i])")
source share