AlBirdie
AlBirdie

Reputation: 2071

Cocoa Touch Framework class dependencies

I've got a Cocoa Touch Framework for iOS8 (obviously) with XCode 6.3 that includes both Swift and ObjC classes. This framework is going to be used in a variety of other projects and requires AFNetworking.

Now I could just copy the AFNetworking files into the framework, but in case the other projects require AFNetworking as well (and add AFNetworking as well via source code or CocoaPods), the project will throw warnings because the AFNetworking classes are included in both the framework and the project and the compiler can't device which one to use.

However, if I don't add the AFNetworking files to the framework, I can't use them, obviously. In my framework development project I've tried to add AFNetworking only to the main project and not the framework, but the framework project still can't find them. Is there a way to have the framework project reference classes from the project that implements it?

Upvotes: 1

Views: 194

Answers (1)

SalvoC
SalvoC

Reputation: 201

If the framework is a project of yours, enable cocoapods on the framework project, add AFNetworking as a pod dependency on that. Doing that you should be able to reach AFNetworking classes from both the framework and the main project that uses it.

Upvotes: 2

Related Questions