I've just upgraded my project to Swift 3 from 2.3. All my for loops are going infinite. I can reproduce it in a fresh playground as well:
Here's what I'm doing:
var strs = [String!]()
strs.append("hello")
strs.append("world")
var count = 0
for s in strs {
count += 1
}
What is wrong? In the playground, the loop executes continuously.
Looking at the docs from Apple, this should work, shouldn't it?
UPDATE: If I change my array definition as follows, it works as expected. What's the harm in forcing non-optional values in an array?
var strs = [String]()
UPDATE 2: This is a known bug - https://bugs.swift.org/browse/SR-1635