In objective-C, my animation bit will look something like this:
[UIView animateWithDuration:0.5 animations:^{ [[[_storedCells lastObject] topLayerView] setFrame:CGRectMake(0, 0, swipeableCell.bounds.size.width, swipeableCell.bounds.size.height)]; } completion:^(BOOL finished) { [_storedCells removeLastObject]; }];
If I outweigh this in Swift, it should look something like this:
UIView.animateWithDuration(0.5, animations: { self.storedCells[1].topLayerView.frame = CGRectMake(0, 0, cell.bounds.size.width, cell.bounds.size.height) }, completion: { (finished: Bool) in
He complains about the missing line. Received Error: Could not find an overload for 'animateWithDuration' that accepts the supplied arguments
I know that closing completion takes a boolean and returns a void, but I should be able to write something that is not related to bool anyway .... right?
Any help is appreciated.
Change This is how I declare the array that I use in the function:
var storedCells = SwipeableCell[]()
An array that accepts SwipeableCell objects.
closures ios8 swift animatewithduration
Nilzone-
source share