Allow NSNotificationCenter notifications to work with swift private methods

Originator:nacho4d
Number:rdar://21830296 Date Originated:
Status:Open Resolved:
Product: Product Version:Xcode 7 Beta 2
Classification: Reproducible:Always
 
Guillermo Ignacio Enriquez Gutierrez15-Jul-2015 03:56 PM

Summary:
Sometimes when observing notifications is a implementation detail I don't want to be exposed. However with current functionality. This cannot be done since a crash will happen when the selector or a Notification is private.

Now I have no choice but to make the method public or internal, exposing the function.

Steps to Reproduce:
1. Start observing a notification with a private method as a handler
2. Fire the notification

Expected Results:
The notification handler is called normally even if it is private

The private handler func is not shown in the generated interface in Xcode (Xcode > Navigate > Jump to generated interface)

Actual Results:
The notification handler is not called. Due to "unrecognized selector sent to instance 0xabc..."

The handler func is shown in the generated interface in Xcode (Xcode > Navigate > Jump to generated interface). It exposes partial implementation details

Version:
Xcode 7 beta 2

Notes:
Also reproducible in Xcode6

Configuration:


Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!