kevlar
kevlar

Reputation: 1173

Changing imports for iOS frameworks

Suppose I have a framework named A.framework with an A.h file as the main import. The standard way the client app would use this framework is:

#import <A/A.h>

Suppose now there exists another framework B.framework whose functionality I want to subsume/override/implement in my A.framework so that the client app could actually unlink B.framework and only link to A.framework to get all of B.framework's functionality. In other words, I have a implemented all of B.framework's functionalities inside A.framework and there is a file you would be able to import via

#import <A/B.h>

such that if the user replaced all of the #import <B/B.h> calls with #import <A/B.h>, they would get all of B.framework's functionality.

My question is: can I let the user just unlink B.framework without replacing all of their #import <B/B.h> calls with #import <A/B.h> and somehow have those #import <B/B.h> import from A.framework instead?

Upvotes: 0

Views: 94

Answers (1)

Liftoff
Liftoff

Reputation: 25392

The way you have described it, yes. If all of your classes/methods/etc. are inside A/B.h that would be retrieved from B/B.h, B.framework is no longer required, as long as A.framework does not reference B.framework directly...if that makes sense...

Think of it this way:

Not allowed

If you are unlinking B.framework in this case, you will get an error when you try to do anything in B.h because the B.h file in A.framework requires B.framework to function.

However, if it looks like this:

Allowed

So your essential components of B.framework are actually inside A.framework (you consolidated them) i.e. A.framework never references <B/*>, you are okay to do that!

Hope that helps you.

Upvotes: 1

Related Questions