NSObject perform Selector get wrong result

If I’m not mistaken, perform is an Objective-C function that takes an id for the with parameter, so Swift is wrapping the 1 in a NSValue object before calling it. What you’re getting is probably the address of that object.
Try to change handler’s value parameter type to Any and see if that works better. (Note that #selector doesn’t carry type information so the compiler can’t detect type mismatches)

1 Like