Xcode-beta (7A165t): Swift class extension with custom obj name use a wrong name when generating Objc header
| Originator: | konstantin.koval1 | ||
| Number: | rdar://22321792 | Date Originated: | 18-Aug-2015 10:17 AM |
| Status: | Closed | Resolved: | 18-Aug-2015 |
| Product: | Developer Tools | Product Version: | Xcode-beta (7A165t) |
| Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary:
I make a Swift class and uses alternative Obj name for it with @objc() attribute
When I make swift extension the Objc generated header uses Swift class name instead of alternative name for that extension.
Steps to Reproduce:
- Make a swift class with alternative name and expose it to Objc
- Make an extension
- Try to use this class in Objc
Code:
@objc(KOKBird) public class Bird: NSObject {
let name = "Swift"
}
public extension Bird {
func fly() {
print("I can Fly!!!")
}
}
/// #import "ExtensionTest-Swift.h"
SWIFT_CLASS_NAMED("Bird")
@interface KOKBird : NSObject
@property (nonatomic, readonly, copy) NSString * __nonnull name;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
@interface Bird (SWIFT_EXTENSION(ExtensionTest)) // Wrong name Here!!!
- (void)fly;
@end
Expected Results:
It should work and use an alternative name for extension when generating Objc header
Actual Results:
It can't compile
Notes:
- Example project is attached
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!
Closed
Fixed in Xcode Version 7.0 beta 5 (7A176x)