Callback function cannot be accessed on its own
don't know how to express the problem correctly, so here is the code:
class Foo {
func foo2(nextCall: ()->()) {
}
func foo(nextCall: ()->()) {
func f1() {
foo2(f1)
}
}
}
Concise, but not sure if it has the same type of problem:
class Foo {
func foo(nextCall: ()->()) {
func f1() {
foo(f1)
}
}
}
Error message: Cannot reference a local function with captures from another local function.
Any ideas how to fix this problem? The provided function is used as a callback function and for some reason I am wondering why the function cannot be used.
+3
source to share