Crashalot Crashalot - 1 year ago 184
Swift Question

Swift 3: Cannot call value of non-function type '(() -> Void)?'

This function worked before the curse of all curses, also known as Swift 3. After migrating to Swift 3, Xcode, my friendly and cuddly IDE, displays this frustrating error against the line


Cannot call value of non-function type '(() -> Void)?'

Several other posts deal with similar errors, but none of those solutions apply.

What is wrong with the line???

func test(_ block: SCNNode, animated: Bool) {
// Do stuff
SCNTransaction.animationDuration = animated ? AnimationDur : 0.0
SCNTransaction.completionBlock {
// Animate stuff

Answer Source

SCNTransaction.completionBlock is a class property. Perhaps you mean this?

//                             ↓
SCNTransaction.completionBlock = {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download