Skip to content

Swift 3.0 Errors for SBGestureTableView.swift #9

@JDSX

Description

@JDSX

There are two complier errors in swift 3.0 for the SBGestureTableView class

1:

C-style statement has been removed in Swift 3
for line 206

    else if gesture.state == UIGestureRecognizerState.ended {
            isEnabled = true
            let indexPath: IndexPath = currentLocationIndexPath!
            let cell = cellForRow(at: indexPath)!
            // remove scrolling CADisplayLink
            scrollDisplayLink?.invalidate();
            scrollDisplayLink = nil;
            scrollRate = 0;

            UIView.animate(withDuration: 0.3, animations: { () -> Void in
                let rect = self.rectForRow(at: indexPath)
                self.draggingView!.transform = CGAffineTransform.identity
                self.draggingView!.frame = self.draggingView!.bounds.offsetBy(dx: rect.origin.x, dy: rect.origin.y)
                }, completion: {(Bool) -> Void in
                    self.draggingView!.removeFromSuperview()
                    cell.isHidden = false
                    let visibleRows: NSArray = self.indexPathsForVisibleRows! as NSArray
                    let mutableRows = visibleRows.mutableCopy() as! NSMutableArray
                    mutableRows.remove(indexPath)
                    let n = mutableRows.count
                    var i = 0, rows: [IndexPath] = []

                   //ERROR
                    for (i = 0; i < n; i += 1) {
                        rows.append(mutableRows[i] as! IndexPath)
                    }
                    self.reloadRows(at: rows as [IndexPath], with: UITableViewRowAnimation.none)
                    self.currentLocationIndexPath = nil
                    self.draggingView = nil
            })
        }

2:

Cannot convert value of type '() -> Void' to expected argument type '(() -> Void)?'

for line 332

    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 anyone know how to fix these issues, they are the final complier errors I am getting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions