benjamin.ludwig
benjamin.ludwig

Reputation: 1585

Swift Cocoa Touch Framework containing another Framework

I'm trying to build a framework that implements a REST API which I want to reuse and share. To handle the network access, I want to use Alamofire inside this API framework. Everything works so far except that my test app, which actually uses my API framework, won't build because Alamofire is missing.

In the app's target I can set "Embedded Binaries" to include my API Framework. If I also include Alamofire there, it works.

Now I wonder if there is a way to put the Alamofire framework into my API framework so that the app only has to include one framework. The API framework's target->general settings don't have the section "Embedded Binaries". But maybe this can be done in another way. Or is this not a good approach at all?

Thanks for your help!

--- UPDATE ---

Of course it is possible to add the source files of the Alamofire framework in my API framework. This way my app only has to import the API framework. But I still wonder if it's possible to include the Alamofire framework in my API framework.

Upvotes: 3

Views: 549

Answers (1)

benjamin.ludwig
benjamin.ludwig

Reputation: 1585

Half a year later I learned that this is simply not meant to work this way in Xcode with iOS frameworks. If a framework depends on other 3rd party frameworks, you need to import those frameworks into your own target. I'm using Xcode 8 beta 3 and nothing changed so far and probably won't in the future.

I think the reason is simple: If the above would be possible, you could end up having one framework included several times in your project, because some of your frameworks include other frameworks include other frameworks include other frameworks include other frameworks include other frameworks...

I think you get the point :P

Upvotes: 3

Related Questions