Getting Started

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.


To use the SDK with CocoaPods, add the following lines to your Podfile:


pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'

Each of these dependencies can be used independently. Exclude any that you don't need.


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).

Connect Your App Delegate

Add the following to your AppDelegate class. This initializes the SDK when your app launches, and lets the SDK handle results from the native Facebook app when you perform a Login or Share action.

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options)

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
# 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.