Hi everyone,
It seems that the enumerate() function syntax has changed since the release of Swift 2.
Here’s the original code from the book:
for (i, string) in enumerate(countingUp) {
// (0, "one"), (1, "two")
}
I found this solution:
for (i, string) in countingUp.enumerate() {
// (0, "one"), (1, "two")
}
What’s your opinion on the matter?
My opinion: If you are developing a new object oriented language, and you want to remain true to the quest, then enumerate() should be a method of an object–not a global function. However, Swift seems to have a lot of “built-in” functions:
practicalswift.com/2014/06/14/th … functions/
[quote=“7stud7stud”]My opinion: If you are developing a new object oriented language, and you want to remain true to the quest, then enumerate() should be a method of an object–not a global function. However, Swift seems to have a lot of “built-in” functions:
practicalswift.com/2014/06/14/th … functions/[/quote]
Thanks 7stud7stud for sharing this link!