Is it possible to call a function as a parameter of another function in Swift
??
I am making a sound effects app in Swift
which uses different effects like AVAudioUnitReverb()
and AVAudioUnitDistortion()
etc. I wanted to create a single function and just be able to call which effects I wanted to do.
Because in Swift functions are first-class types, you can pass it as an argument to another function.
Example:
func testA() {
print("Test A")
}
func testB(function: () -> Void) {
function()
}
testB(testA)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments