Use non-ascii characters in NSObject class name in Swift and expose it to Objective-C

Originator:onevcat
Number:rdar://22737851 Date Originated:17-Sep-2015 10:04 PM
Status:Open Resolved:No
Product:Xcode Product Version:7.0
Classification:Developer Tools Reproducible:Always
 
Summary:
In Xcode 6, an @objc(ClassName) could be used to an NSObject class with its name containing non-ascii characters in Swift. By doing so, we could expose it to Objective-C with the alternative name. 

However, in Xcode 7 and Swift 2, it will not compile with an error: "Parameter of 'swift_name' attribute must be an ASCII identifier string", which causes classes with non-ascii characters cannot be used in Objective-C.

Steps to Reproduce:
1. Create a Swift class like this in a project: 
@objc(MyClass)
class 我的类: NSObject {
    @objc(greeting:)
    func 打招呼(名字: String) {
        print("哈喽,\(名字)")
    }
}

2. In the same project, create an Objective-C class and add "#import {ProjectName}-Swift.h"

3. Not compile with "Parameter of 'swift_name' attribute must be an ASCII identifier string"

Expected Results:
It should compile and we can use
 [[[MyClass alloc] init] greeting:@"John"]; 
to log out a string: "哈喽,John"

Actual Results:
Not compile

Version:
Xcode 7 (7A218)

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!