Hello, We are using a Swift library that has the ...
# ios
t
Hello, We are using a Swift library that has the following implementation
Copy code
@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
Copy code
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
Copy 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.