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 SCNTransaction.completionBlock
:
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.begin()
SCNTransaction.animationDuration = animated ? AnimationDur : 0.0
SCNTransaction.completionBlock {
block.removeFromParentNode()
}
// Animate stuff
SCNTransaction.commit()
}
SCNTransaction.completionBlock is a class property. Perhaps you mean this?
// ↓
SCNTransaction.completionBlock = {
block.removeFromParentNode()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With