# Setting up your project

This topic explains how to integrate the LINE SDK for iOS Swift into your iOS project and apply necessary configurations.

To make your app compatible with the latest iOS versions and make full use of its features, we strongly recommend you follow this installation guide and use the latest version of the LINE SDK for iOS Swift.

# Prerequisites

To build and use the LINE SDK for iOS Swift, you need:

  • A provider and a LINE Login channel. You can create both in the LINE Developers Console.
  • iOS 11.0 or later as the deployment target
  • Xcode 10 or later

You can use the LINE SDK for iOS Swift with either Swift or Objective-C code. This guide assumes that you use Swift code to implement the LINE SDK for iOS Swift. To use Objective-C code to integrate the LINE SDK for iOS Swift, see Using the SDK with Objective-C.

# Installation

The LINE SDK for iOS Swift is not compatible with previous LINE SDK for iOS Objective-C versions. If you are upgrading the version of the LINE SDK, see Upgrading the SDK before proceeding with the upgrade.

# CocoaPods

If you aren't familiar with CocoaPods, see CocoaPods Getting Started Guide (opens new window). You will need the CocoaPods gem installed on your machine before integrating the LINE SDK for iOS Swift into your app through CocoaPods.

  1. Once your Podfile is prepared, add the pod command below to your target:

    platform :ios, '11.0'
    target '<Your App Target Name>' do
        pod 'LineSDKSwift', '~> 5.0'
  2. Run the following command:

    $ pod install

The LINE SDK for iOS Swift will be downloaded and integrated into your Xcode workspace.

# Carthage

Carthage (opens new window) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

  1. To install the Carthage tool, use Homebrew (opens new window).

    $ brew update
    $ brew install carthage
  2. To integrate the LINE SDK for iOS Swift into your Xcode project using Carthage, specify the GitHub repository of the SDK in your Cartfile as below:

    github "line/line-sdk-ios-swift" ~> 5.0
  3. Run the following command to build the LINE SDK for iOS Swift:

    $ carthage update line-sdk-ios-swift

Now you can add the built LineSDK.framework file to your Xcode project by following the steps described in the following sections.

# Linking the LineSDK.framework file to your Xcode project

Drag and drop the LineSDK.framework file from the Carthage/Build/iOS folder to the "Linked Frameworks and Libraries" section on your application target’s "General" settings tab.

LINE SDK Framework file being moved from Finder to the Linked Frameworks and Libraries section in your app target.

# Copying the LineSDK.framework file during the build phase

  1. Click the "+" icon on your application target's "Build Phases" settings tab and choose "New Run Script Phase". Create a run script with the following content:

    /usr/local/bin/carthage copy-frameworks
  2. Add the path to the LineSDK.framework file under the "Input Files" section:

  3. Add the path to the LineSDK.framework file under the "Output Files" section:


The run script should look like this:

Run script section expanded to show Shell, Input Files, Input File Lists, and Output Files.

# Linking your app to your channel

Linking your app to a LINE Login channel requires some configuration. On the LINE Developers Console, go to your LINE Login channel settings and complete the following fields on the LINE Login tab:

  • iOS bundle ID: Bundle identifier of your app found in the "General" tab in your Xcode project settings. Must be lowercase. For example, com.example.app. You can specify multiple bundle identifiers by entering each one on a new line.
  • iOS universal link: Enter the universal link configured for your app. For more information on how to handle the login process using a universal link, see Using universal links.

LINE Login iOS bundle ID and universal link settings.

# Configuring the Info.plist file

In Xcode, right-click your app's Info.plist file and select "Open As" > "Source Code". Insert the following snippet just before the last </dict> tag:

            <!-- Specify URL scheme to use when returning from LINE to your app. -->
    <!-- Specify URL scheme to use when launching LINE from your app. -->

This snippet adds the following settings:

Key Description
CFBundleURLSchemes Use line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER) to define the URL scheme needed to open your app. iOS stores this URL scheme for later reference. LINE Login uses this scheme to open your app after the LINE Platform returns a login result.
Note: The URL scheme lineauth2 is already used to activate LINE. Do not use this scheme in CFBundleURLSchemes.
LSApplicationQueriesSchemes Specify lineauth2 to allow launching of LINE from your app. The app will launch LINE as part of the login process.