[Swift 2] Classes exposed to ObjC with different names do not have their extensions renamed correctly
| Originator: | wirth_caesar | ||
| Number: | rdar://22005388 | Date Originated: | 27-Jul-2015 03:18 PM |
| Status: | Duplicate of 21929752 (Closed) | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 7 beta 4 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
If I create a class in Swift, I will usually expose it to Objective-C with a different name, to allow for prefixing. So far, so good. However, if I make an extension of the class, it no longer builds. The reason being that, while the original class name changed for Objective-C, the extension's class name did not change...
Steps to Reproduce:
1. Create a project that is using both Swift and Objective-C.
2. Paste the following class and extension into some Swift file:
@objc(MyProjectMyClass)
class MyClass: NSObject { }
extension MyClass { }
3. Include MyProject-Swift.h in one of the Objective-C files
4. Try to build the project.
5. Look at the errors; specifically the MyProject-Swift.h header. The problem area in question looks like this:
SWIFT_CLASS_NAMED("MyClass")
@interface MyProjectMyClass : NSObject
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
@interface MyClass (SWIFT_EXTENSION(MyProject))
@end
Expected Results:
I would expect it to rename the extension to be the same as the class itself, and be able to compile.
Actual Results:
It creates an extension off of a class that does not exist, and accordingly fails to compile ><
Version:
Mac OS X 10.10.4 (14E46)
Xcode 7 beta 4 (7A165t)
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!