Skip to content

Instantly share code, notes, and snippets.

@pzmudzinski
Created November 14, 2018 21:44
Show Gist options
  • Save pzmudzinski/b414df945861783b52e662f27d01356f to your computer and use it in GitHub Desktop.
Save pzmudzinski/b414df945861783b52e662f27d01356f to your computer and use it in GitHub Desktop.
items = collectionActions.scan([], accumulator: { (currentBooks, action) -> [Book] in
switch action {
case .bookMarkedForDeletion(let book):
return currentBooks.filter { $0 != book }
case .collectionRefreshed(withBooks: let books):
return books
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment