"partial apply forwarder for reabstraction thunk helper" type

I'm trying to add some event handlers to the AppDelegate in the form of Optional closures like this:


var applicationEventHandler: ((ApplicationEvent) -> ())?


In my didFinishLaunchingWithOptions-function I set this property to the following function


applicationEventHandler = handleApplicationEvent


func handleApplicationEvent(event: ApplicationEvent){
  switch event {
      //...
     }
  }


However, when I try to call this function via the property, nothing happens. Looking at the debugger, the property does not receive the expected type after assigning it, but instead it says "0x00082120 FöliGuide`partial apply forwarder for reabstraction thunk helper from @callee_owned (@unowned Fo_liGuide.ApplicationEvent) -> (@unowned ()) to @callee_owned (@in Fo_liGuide.ApplicationEvent) -> (@out ()) at AppDelegate.swift"


I'm completely lost as to what is going on. Can anyone help me out?


(Happens on both the latest Xcode stable and Beta release)


Here's a screenshot of the property description:

http://dump.vfuc.co/2016-01-25/bug.png

One thing you need to know is that treating methods as closures is not an easy thing.

The output type `partial apply forwarder for ...` is just an internal representation of the method closure, which means your `applicationEventHandler` is holding what you expect to be held.


As far as I tested in a small project, with importing your lines shown above, calling `applicationEventHandler` works as expected:

import UIKit
enum ApplicationEvent {
    case ButtonPress
}
class ViewController: UIViewController {
    var applicationEventHandler: ((ApplicationEvent) -> ())?
    override func viewDidLoad() {
        super.viewDidLoad()
        //
        applicationEventHandler = handleApplicationEvent
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        //
    }

    func handleApplicationEvent(event: ApplicationEvent) {
        switch event {
        case .ButtonPress:
            print("Button pressed")
        //...
        }
    
    }

    @IBAction func buttonPressed(_:AnyObject) {
        applicationEventHandler?(.ButtonPress)
    }
}

(Outputs "Button pressed", when I press the button connected to `buttonPressed`.)


If call this function via the property, nothing happens, other parts of your code may be affecting.

Check them or show us some relevant parts.


(Directly assigning a method closure to strong reference property of the same class may cause "circular reference", but that's another problem and I ignored it in the testing code.)

Thanks for the input, I appreciate it!

"partial apply forwarder for reabstraction thunk helper" type
 
 
Q