public class A {
public var target: NSObject
public var action: Selector
public init(target: NSObject, action: Selector) {
self.target = target
self.action = action
}
public func call() {
self.target.perform(action, with: 1)
}
}
public class B : NSObject {
public var a: A!
public override init() {
super.init()
a = A.init(target: self, action: #selector(handler(value:)))
}
@objc func handler(value: Int) {
print("handle callback: \(value)")
}
}
let b = B.init()
b.a.call() // handle callback: -2069308530273730897
Hi, All:
as shown above, the @objc function gets called with a parameter 1, but the print result is different, what's wrong with this?