fileprivate NSTableCellView subclass cannot be loaded from nib at runtime

Originator:preble
Number:rdar://31999782 Date Originated:2017/05/04
Status:Duplicate/22824023 Resolved:
Product:Developer Tools/AppKit Product Version:Xcode 8.3.2, macOS 10.12.4
Classification: Reproducible:Always
 
Summary:
When using a custom subclass of NSTableCellView, if the class is marked "fileprivate" in Swift, AppKit will fail to load the class from the storyboard.

Steps to Reproduce:
1. Create a subclass of NSTableCellView in Swift. It doesn't need to have anything in it. Leave it with the default "internal" access.
2. Create an NSTableView in the storyboard editor, add it to a view controller.
3. Change the class of one of the cells to the subclass you created.
4. Create and wire up a simple data source for the table view.
5. Run the app and observe that the custom cell view subclass is successfully loaded. (you can override awakeFromNib to verify this)
6. Change the access of your cell view subclass to "fileprivate".
7. Run the app again and observe that it fails to load the cell view class.

Expected Results:
fileprivate access should not affect AppKit's ability to load the class, as with other classes used in Interface Builder.

Actual Results:
AppKit fails to load the custom class with this console message:

Unknown class _TtC17TableViewCellDemo15MyTableCellView in Interface Builder file at path <snip>/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib

If overriding tableView(_:viewFor:row:) and calling make(withIdentifier:owner:), an NSTableCellView is returned (but not the custom class specified in IB).

Version:
Xcode 8.3.2 (8E2002), macOS 10.12.4 (16E195)

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!