frameProcessingCompletionBlock in swift
filter!.frameProcessingCompletionBlock({ (filter: GPUImageOutput!, frameTime: CMTime) in
weakUIElementInput?.update()
})
I keep getting "missing argument for parameter #2"
weak var weakUIElementInput = uiElementInput
filter!.frameProcessingCompletionBlock? { (filter: GPUImageOutput!, frameTime: CMTime) -> Void in
weakUIElementInput?.update()
}
Trying this now
You're setting a block, so you need to use an equals sign there to assign your closure:
filter.frameProcessingCompletionBlock = { (currentFilter, frameTime) in
// Run whatever
}
Just a heads up, that doesn't work. At least not in xcode 6 beta 4.
The only syntactical variation I got to work at all was this.
weak var weakUIElementInput = uiElementInput
func updater(filter: GPUImageOutput!, frameTime: CMTime) -> Void {
weakUIElementInput?.update()
}
filter!.frameProcessingCompletionBlock = updater
Really? The exact same syntax as I posted above worked in a Swift playground from beta 3 - beta 5 for me. It's valid syntax for setting a closure with the two inputs required, and I verified that it fired properly.
You might need to unwrap your optional filter in your case:
filter!.frameProcessingCompletionBlock = { (currentFilter, frameTime) in
// Run whatever
}
but that's perfectly valid closure syntax. Check to make sure you typed this right.