Skip to content

Commit

Permalink
When inside an implicit transaction completion, use the current item …
Browse files Browse the repository at this point in the history
…list instead of a captured copy to fix #21
  • Loading branch information
mindz-eye committed Jan 27, 2018
1 parent aecfe13 commit e13871f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions MYTableViewIndex/Private/IndexView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,12 @@ class IndexView : UIView {
}

private func removeItem(_ item: UIView) {
guard let items = items else {
return
}
// A little trickery to make item removal look nice when performed inside an animation block
// (e.g. when the keyboard shows up)
CATransaction.setCompletionBlock {
item.alpha = 1

if (!items.contains(item)) {
if let items = self.items, !items.contains(item) {
item.removeFromSuperview()
}
}
Expand Down

0 comments on commit e13871f

Please sign in to comment.