Jordan Schalm Jordan Schalm - 1 year ago 284
Swift Question

How to manually import third party Swift framework into Swift iOS project?

I am trying to import and use the OAuthSwift library in the Swift iOS project. I followed their directions:

  • Drag OAuthSwift.xcodeproj to your project in the Project Navigator.

  • Select your project and then your app target. Open the Build Phases panel.

  • Expand the Target Dependencies group, and add OAuthSwift framework.
    import OAuthSwift whenever you want to use OAuthSwift.

After completing these steps, importing OAuthSwift using
import OAuthSwift
causes the error
No such module 'OAuthSwift'
and the project fails to build.

I have tried the following steps, based on a number of other SO questions about similar issues:

  • Clean and rebuild

  • Add the OAuthSwift framework to many different combinations of
    Build Phases > Target Dependencies
    Build Phases > Link Binary With Libraries
    Build Phases > Embed Frameworks
    , and
    General > Embedded Libraries

  • Set
    Build Settings > Search Paths > Framework Search Paths
    Build Settings > Search Paths > Library Search Paths
    and recursive.

  • Verify that my deployment target matches the deployment target of the
    Xcode project.

I have tested this using the latest version of
from their master branch using a git submodule, as well as manually downloading and importing each of the two latest tagged versions (0.6.0 and 0.5.2).

I have also created a brand new Xcode project, imported OAuthSwift as above, and encountered the same error.

Finally, I also tried importing a different Swift Framework (Alamofire), following the steps as stated on the README at This caused the same error as well:
No such module 'Alamofire'

I am using:

  • OSX 10.11.6

  • Xcode 7.3.1

  • Swift 2.2

I'm still fairly new to Xcode and the Swift module system, so any help or suggestions is appreciated.

Answer Source

Your life will be a lot easier if you import the framework using CocoaPods. If you haven't used them before, it's really easy once you get set-up. You use Ruby Gems on the command line to install CocoaPods (sudo gem install cocoa pods) and then create a create a pod file using pod init. After this you modify it to include:

platform :ios, '8.0'


pod 'OAuthSwift', '~> 0.5.0'

Save the file and run pod install.

Once this is complete you will have to close out the Xcode project and use the newly created .xcworkspace project file (not the .xcodeproj) from here forward.

Here is a link to another post for a secondary reference. How to install cocoa pods?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download