Skip to content

Instantly share code, notes, and snippets.

@marinbenc
Created January 15, 2016 22:02
Show Gist options
  • Select an option

  • Save marinbenc/421c2f7e185394e8578c to your computer and use it in GitHub Desktop.

Select an option

Save marinbenc/421c2f7e185394e8578c to your computer and use it in GitHub Desktop.
The night I invented array subscripting
//I was really tired when I wrote this:
//(I later replaced it with the two lines below)
// if let sound = Sound(index: soundData.soundNum, position: soundData.position) {
// positions
// .filter{$0.index == sound.position}
// .last?
// .sounds
// .append(sound)
// }
if let sound = Sound(index: soundData.soundNum, position: soundData.position) {
positions[soundData.position].sounds.append(sound)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment