Open swift-ci opened 8 years ago
Comment by Yan Li (JIRA)
I looked into this one today.
First I thought it can be easily implemented by enumerating all loaded bundles and try to find where the class lives. It can be something like this:
let allBundles = NSBundle.allFrameworks() + NSBundle.allBundles()
let bundlesContainingClass = allBundles.filter {
return $0.loaded
}.filter {
return $0.classNamed(aClass.description()) != nil
}
return bundlesContainingClass.first!
But then I found out that many methods this implementation depends on are actually based on Objective-C runtime, for example: NSBundle.load(), NSBundle.classNamed(: ), etc. And in corelibs they are also NSUnumplemented().
So I think this task is actually depending on some other deeper tasks.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 2 | |Component/s | Foundation | |Labels | Task | |Assignee | mamabusi (JIRA) | |Priority | Medium | md5: 5b239564779b3473db72152901b916dfIssue Description:
https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSBundle.swift:
public init(forClass aClass: AnyClass) { NSUnimplemented() }