Created
April 6, 2016 04:03
-
-
Save onevcat/3da91b1b1c9409c9e57536a5736396f0 to your computer and use it in GitHub Desktop.
AnyGenerator Leak?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let count = 3 | |
var current = 0 | |
let g = AnyGenerator<Int>(body: { | |
if current < count { | |
current += 1 | |
return current - 1 | |
} else { | |
return nil | |
} | |
}) | |
while let num = g.next() { | |
print(num) | |
} |
Author
onevcat
commented
Apr 6, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment