[swift-users] Confused/Surprised by IndexingIterator.forEach behavior

Guillaume Lessard glessard at tffenterprises.com
Wed Dec 28 13:28:01 CST 2016

forEach is defined by the Sequence protocol, and is not a mutating function. By definition, it must create a local iterator in order to perform its duty. As a consequence, the variable `stream` is the same immediately before and after the forEach call.

Guillaume Lessard

More information about the swift-users mailing list