I got some issue with closure/struct/capturing properties.
I can't really explain the architecture but i need to have something like this:
class ControllerAAA {
struct Events {
var userDidSelect(_ controller: Controller) -> ()?
}
}
class ControllerBBB {
var foo: Foo
var events: ControllerAAA.Events(userDidSelect: {
(controller: Controller) -> ()? in
// Here i need foo. Self mean the Block not the Controller
})
// Then i will passed events when i call ControllerAAA and ControllerAAA will use events.userDidSelect(...) when he is done.
}
Is it possible to reach “self” in closure that is in struct constructor defined in class?