C4Labs / C4iOS

C4 is an open-source creative coding framework that harnesses the power of native iOS programming with a simplified API that gets you working with media right away. Build artworks, design interfaces and explore new possibilities working with media and interaction.
www.c4ios.com
MIT License
981 stars 75 forks source link

use iterating instead of Integer indexing #656

Closed ha1f closed 8 years ago

ha1f commented 8 years ago

I think, if you use ".count" method, swift will see though the sequence and count elements.

So, we should use for-iteration or .first/.last property instead of integer indexing.

You may think ".dropFirst()" method mutate structure because of the name, but ".removeFirst()" method is the function, and .dropFirst() method just returns the subsequences.

And this is just a question, https://github.com/C4Framework/C4iOS/blob/master/C4/UI/Shape%2BCreation.swift#L98 In this method, you set path if the variant is nil, but not newPath. But you force-unwarp variable "newPath". Isn't this a bug?