Tristan
11/05/2025, 10:11 PM@objc
public func startProcess(_ configuration: Configuration? = nil,
delegate: ProcessDelegate) {
// ...
execute(using: params) { [weak self, weak delegate] in
self?.notifyDelegate(delegate, event: $0)
}
}
What we were doing on Kotlin's end
startProcess(config, object : NSObject(), ProcessDelegate { /** rest */ })
And this caused us to not received any callback, we did not not it was a weak reference. Since we are not holding any reference to it. So we had to adjust our Kotlin code
var delegate: ProcessDelegate? = object : NSObject(), ProcessDelegate { /** rest */ })
startProcess(config, delegate)
// ...
delegate = null
It's no big deal, but for people not familiar not familiar with this concept, it could be frustrating.
Do you think some mechanism could be applied at compile time so it does not lose the reference? I doubt, but worth asking.