The Facebook SDK for Swift is distributed via CocoaPods and Carthage. While you may compile and use the SDK outside of these systems, we strongly recommend that you choose one of them.
CocoaPods
To use the SDK with CocoaPods, add the following lines to your Podfile:
use_frameworks!
pod ‘FacebookCore’
pod ‘FacebookLogin’
pod ‘FacebookShare’
Each of these dependencies can be used independently. Exclude any that you don’t need.
Carthage
To use the SDK with Carthage, add the following line to your Cartfile:
github “facebook/facebook-sdk-swift”
After performing a carthage install, add FacebookCore.framework, FacebookLogin.framework, and FacebookShare.framework to your project, along with their Facebook SDK for iOS dependencies (FBSDKCoreKit.framework, FBSDKLoginKit.framework, FBSDKShareKit.framework).
Manually Compiling
While not recommended, it is entirely possible for you to build the Facebook SDK for Swift outside of any dependency management system. Note that you will need to manage the process of updating this solution, as well as the dependencies is has on the Facebook SDK for iOS.
To compile the SDK manually, start by cloning the repository:
git clone https://github.com/facebook/facebook-sdk-swift.git
# Once that’s completed, you should initialize all submodules:
cd facebook-sdk-swift
git submodule update –init –recursive
After you’ve initialized the repository, add the FacebookSwift.xcodeproj as a sub-project to your application’s project, and then add the FacebookCore.framework, FacebookLogin.framework, and FacebookShare.framework build products from that subproject to your applications Link Frameworks and Libraries section, as well as your Embedded Binaries section. Don’t forget to embed/link FBSDKCoreKit.framework, FBSDKLoginKit.framework, and FBSDKShareKit.framework.