Skip to content

Instantly share code, notes, and snippets.

@kwylez
Last active February 10, 2016 03:59
Show Gist options
  • Save kwylez/384f89a080e057cfff14 to your computer and use it in GitHub Desktop.
Save kwylez/384f89a080e057cfff14 to your computer and use it in GitHub Desktop.
/// Iterate and add subviews plus the index value
var currentIndex = 0
let updatedIndexes = items.map({ (item: MenuItem) -> MenuItem in
item.index += currentIndex
item.delegate = self
currentIndex++
self.addSubview(item)
return item
})
self.menutItems += updatedIndexes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment