New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-2345] Linker Error: Nested classes are hidden from the Linker when calling class methods from Objective-C #44952
Comments
This issue does not reproduce with Xcode 7.3.1. |
The linker error in question:
|
If I run
So we're creating the metaclass runtime info for |
Comment by Frederic Barthelemy (JIRA) My NSClassFromString workaround appears to no longer work for Beta6, updated description after testing the top-level unnested class bounce strategy. |
Comment by Frederic Barthelemy (JIRA) I spoke too soon. Using a top level subclass of the nested class doesn't work either. It leads to a similar linker error as above. 🙁 |
Comment by Frederic Barthelemy (JIRA) Function bound to a top-level class can return the class appears to work in Beta6: public extension A {
public class func A.B_LinkerBypass() -> AnyClass {
return A.B.classForCoder()
}
} |
Comment by James Richard (JIRA) Just ran into this bug in an obscure way. We don't directly use our nested class via Obj-C code, but we were encoding one into an archive file. Upon unarchiving the Obj-C runtime would search for the class. It'd fail as the symbols aren't there, so we were getting this error:
|
Environment
Occurs in (Swift3):
Version 8.0 beta 6 (8S201h)
beta 5
(not verified in other beta versions)
macOS 10.11.6
Additional Detail from JIRA
md5: f887ae0d676991544eca9354bd94d1b3
duplicates:
Issue Description:
Scenario:
In Objective-C:
If you examine the -Swift.h bridging header, your classes & methods are properly exposed
Expectation:
Workarounds:
Call Swift-defined accessible class's method to return an AnyClass reference to bounce into the unaccessible class.
Call Swift-defined non-class functions to bounce into the class method.
Call NSClassFromString to get the class reference.No longer works as of Beta6Create a top-level unnested Swift subclass of your class and reference that when calling class methods.The text was updated successfully, but these errors were encountered: