Hi Kyle,
Thanks for taking time to respond. I'd like to publish two libraries for
use; either dynamic or static; it shouldn't matter.
Can you elaborate on why would that make a difference? I'm not sure I fully
understand dynamic frameworks.
When I say classB.framework, I just meant a framework which contains
classB.
I'm not sure what's the best way to package the libraries, but here is my
Goal:
- Class A is a superclass of Class B and Class C
- Assume B and C are very heavy and can be used independently.
- Class A contains a static factory method which can return either Class
B or Class C
- This is because we'd like to mimic the usage pattern of another iOS
framework.
- We'd like to allow the user to use classC and classB independently
without loading both.
I.e: When the user is using B it shouldn't require the application to
load C.
My question is then, how do I structure the frameworks to allow the user to
load either independently?
To clarify my earlier 'dynamic load' statement: I meant avoiding explicitly
importing and use runtime to allocate & instantiate an object.
On Sun, Jun 19, 2016 at 9:54 AM, Kyle Sluder <[email protected]> wrote:
> On Sat, Jun 18, 2016, at 11:56 PM, Tom Steward wrote:
> > I am trying to build Objective-C static frameworks but ran into
> > hierarchy/organization problems.
>
> You talk about “static frameworks”, but then proceed to discuss
> “classB.framework”, etc., implying you are actually talking about
> dynamic frameworks. Which are you trying to achieve?
>
> --Kyle Sluder
>
> >
> > For the question, assume I have 3 classes, classA, classB, and classC.
> > classB and classC are children classes of classA. classB and classC each
> > needs special resource files.
> >
> > #import "classB.h"
> > #import "classC.h"
> > @implement classA
> >
> > + (classA)factoryMethodCreateType:(NSString *)type {
> > classA a;
> > if ([type isEqualToString:@"classB"]) {
> > a = [[classB alloc] init];
> > } else if ([type isEqualToString:@"classC"]) {
> > a = [classC alloc] init];
> > }
> > return a;
> > }
> >
> > @end
> >
> > I'd like to statically package the frameworks, classB.framework and
> > classC.framework, such that when a user wants to use classB, they don't
> > need to include classC and its resource files. Additionally, the user can
> > use classA as the entry point to use either of the frameworks.
> >
> > I assume if I just create classB.framework (includes classA and classB)
> > and
> > classC.framework (includes classA and classC), when the user wants to use
> > both types and include both frameworks, the user will face duplicate
> > symbols?
> >
> > What is the best way to handle this situation? Is the following approach
> > the best way to do it?
> >
> > Change classA's implementation to dynamic creation of classB or classC
> > and
> > not include their header files.
> >
> > Build 3 frameworks instead of 2: classA.framework, classB.framework,
> > classC.framework. When the user wants to use classB, the the user should
> > include both classA.framework and classB.framework.
> >
> > @implement classA
> > + (classA)factoryMethodCreateType:(NSString *)type {
> > classA a;
> >
> > id obj = [NSClassFromString(type) alloc];
> > a = objc_msgSend(obj, @selector(init));
> > return a;
> > }
> >
> > @end
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Objc-language mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
>
> https://lists.apple.com/mailman/options/objc-language/tom.jeff.steward%40gmail.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/objc-language/archive%40mail-archive.com
This email sent to [email protected]