Objective-C class is interpreted as Swift class in Interface Builder
| Originator: | m.quinones.garcia | ||
| Number: | rdar://19764309 | Date Originated: | 09/02/2015 |
| Status: | Closed | Resolved: | Can't reproduce |
| Product: | Xcode | Product Version: | Version 6.2 (6C86e |
| Classification: | Reproducible: | Sometimes |
Summary: A project has a subview class, implemented in Objective-C. When this class is exposed and used in Swift part of application, changing the class of a view in Interface Builder may instantiate a Swift class instead of an Objective-C class. The result is the subview having the original class in interface builder. If it was dragged from a 'View', it will be an instance of UIView, if it was dragged from 'ImageView', it will be an instance of UIImageView. Steps to Reproduce: 1. The project has a UIView subclass, which is used in Objective-C code and in some Interface Builder file, like a View Controller's View. 2. After application has been built and deployed to app store, add a swift file and a bridging header. 3. Add that UIView subclass to the Swift bridging header 4. On the application, Swift code, that subclass can be used as expected. 5. Add a new View Controller and a XIB file for the user interface 6. Change the class of one subview to that UIView subclass, set the outlet to the controller Expected Results: At run time, the class is assigned as expected. Actual Results: Outlet will refer to a Swift class - Name is mangled with App module name, so it can't resolve to an instance of that class. The result is the subview having the original class in interface builder. If it was dragged from a 'View', it will be an instance of UIView, if it was dragged from 'ImageView', it will be an instance of UIImageView. Version: XCode Version 6.2 (6C86e) Notes: Please note that after creating a project from scratch to reproduce the issue, it could not be found anymore. There are additional steps to reproduce the problem but we could not find them. 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!