Implementing Bundle.init(for aClass: AnyClass)

Hi

init(for aClass: AnyClass) is an unimplemented API on Linux. I am exploring around this to implement the same and have a couple of queries:

-> In the context of Linux platform, how relevant is this API for loading bundles dynamically?

-> In a Bundle, how do I go about getting information on the classes that are available within it?

Any related insights/suggestions would help.

Thanks

Mamatha

Hi Mamatha,

Hi

init(for aClass: AnyClass) is an unimplemented API on Linux. I am exploring around this to implement the same and have a couple of queries:

-> In the context of Linux platform, how relevant is this API for loading bundles dynamically?

On Darwin, this API really only works if the bundle is already loaded. It’s more about getting the NSBundle instance for a particular class.

-> In a Bundle, how do I go about getting information on the classes that are available within it?

On Darwin (again) we ask dyld for the library that holds the pointer for the class info, then use further dyld functions to find the path for that library, and use that info to construct the bundle.

These seem reasonable on Linux and in Swift, if we can get some kind of metadata about the class.

- Tony

···

On Nov 18, 2016, at 3:03 AM, Mamatha Busi via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:
Any related insights/suggestions would help.

Thanks

Mamatha

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

1 Like