I am trying to fix my finale error whilst trying to convert to Swift 3, however I am unsure why I am getting the error
Cannot convert value of type '() -> Void' to expected argument type '(() -> Void)?'
For
CATransaction.setCompletionBlock(completion)
Complete Function
fileprivate func deleteRowsAtIndexPaths(_ indexPaths: [IndexPath], withRowAnimation animation: UITableViewRowAnimation, duration: TimeInterval, completion:() -> Void) {
CATransaction.begin()
CATransaction.setCompletionBlock(completion) //Error
UIView.animate(withDuration: duration) { () -> Void in
self.deleteRows(at: indexPaths, with: animation)
}
CATransaction.commit()
}
Does anybody know why I am getting this and how I can resolve the error ?