Accessing the bundle of the call-site
Accessing the bundle of the call-site
- Subject: Accessing the bundle of the call-site
- From: Rick Aurbach <email@hidden>
- Date: Thu, 01 Dec 2016 14:20:39 -0500
- Acceptlanguage: en-US
- Thread-topic: Accessing the bundle of the call-site
Does anyone know if it is possible to do the following in Swift 3.x? (I’ll describe the issue abstractly first, then give the use-case.)
Consider two modules: A and B. A could be either the main module of an application or an embedded framework. B is a different embedded framework.
Now A contains an public extension of class X which contains a function f(). Inside B, there is a reference to X.f(). Now what I want to do in f() is to access information (a module name or bundle name or bundle ID or something) that allows me to construct a Bundle object referring to B, without f() having any external knowledge of the organization of the application.
The use-case I’m thinking about is a localization extension of String that works in a multi-framework application architecture without requiring the caller to specify the name of the framework and/or module.
I.e., “foo”.localize() would access the localized.strings file for the framework in which it was called.
Is this possible? If so, can you give me a few pointers on how to make this work??
Thanks,
Rick Aurbach
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden