Receiver icon indicating copy to clipboard operation
Receiver copied to clipboard

test_MultipleListeners() failing with Xcode 10.1

Open kevincador opened this issue 5 years ago • 2 comments

Hey,

I discovered an issue (probably due to iOS 12/Swift 4.2/Xcode 10) that breaks the ability to have multiple listeners. Basically, only the first listener seems to receive the broadcasts.

I ran the tests on the latest version here and test_MultipleListeners() fails. Running on Xcode 10.1.

Thanks for your feedback!

Kevin

kevincador avatar Dec 27 '18 14:12 kevincador

I think I identified the issue. It's when a key needs to be generated to store the handler:

_key = (_handlers.keys.map { $0.hashValue }.max() ?? -1) + 1

It seems like the keys are always the same at some point.

I'm still investiguating.

If you can explain the logic here for the key, I can try to fix it myself and make a pull request. If it helps...

kevincador avatar Dec 27 '18 15:12 kevincador

It works as expected when removing the hashValue:

_key = (_handlers.keys.max() ?? -1) + 1

I don't really understand why this hashValue is important.

Let me know if I can help further.

kevincador avatar Dec 27 '18 16:12 kevincador