Skip to main content
All CollectionsInstallation
Mobile SDK Installation Guide for iOS
Mobile SDK Installation Guide for iOS
Hakan Baybas avatar
Written by Hakan Baybas
Updated over a week ago

Commented's Mobile SDK for iOS allows you to integrate Commented's commenting and collaboration features seamlessly into your iOS application. With this SDK, you can provide a collaborative environment for your app users to leave comments and feedback right within your mobile app.

Mobile SDK Installation for iOS: A Step-by-Step Guide

Follow these steps to install Commented's Mobile SDK on your iOS application:

Step 1: Install CocoaPods

1. Install Ruby:

First, you may need to install Ruby on your computer. To check if Ruby is installed, open the Terminal and run the following command:

ruby -v

If Ruby is not installed, you can install it from the official Ruby website or using a tool like Ruby Version Manager (RVM).

2. Install CocoaPods:

After installing Ruby, open the Terminal and use the following command to install CocoaPods:

gem install cocoapods

This command will download and install the latest version of CocoaPods.

3. Verify Successful Installation:

After CocoaPods is installed, verify the installation by running the following command:

pod --version

You should see the version number if CocoaPods was successfully installed.

Step 2: Install Commented Pod

1. Navigate to Your Project’s Root Directory:

First, you need to navigate to the root directory of the project where you want to use the Commented pod. You can do this in the Terminal using the cd command. For example, if your project is located in a directory called "MyProject," you can navigate to it with the following command:

cd /path/to/MyProject

Replace "/path/to/MyProject" with the actual path to your project's root directory. Once you're in the project's root directory, proceed to the next steps.

2. Add CocoaPods Podfile to Your Project:

Navigate to the root directory of the project where you want to use the Commented pod. Open the Terminal and use the following command to create a Podfile:

pod init

This command will create a file named Podfile in the root directory of your project.

3. Edit the Podfile:

Open the Podfile using a text editor and add the Commented pod as follows:

target 'YourProjectName' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Pods for YourProjectName
pod 'CommentedSDK'
end

Replace 'YourProjectName' with the name of your project's name.

5. Install the Pods:

Open the Terminal and use the following command to install the pods listed in your Podfile:

pod install --repo-update

We strongly recommend using --repo-update with your installation in order to get latest version of the Commented. This command will download the specified pods and integrate them into your project.

6. Use the Workspace:

After the pod install process is complete, CocoaPods will create a .xcworkspace file for your project. You should use this workspace to work on your project because the pods are included in this workspace.

Step 3: Start Using Commented in AppDelegate

1. Initialize Commented

To use the "Commented" library in your Swift project, you need to import it at the top of your Swift files where you plan to use it. Open the AppDelegate.swift file and add the following import statement:

import CommentedSDK

In your project's AppDelegate.swift file, initialize the "CommentedSDK" library. Locate the application(_:didFinishLaunchingWithOptions:) function and add the following line of code just before the return true statement:

Commented.shared.start(projectId: "commented-project-id")

You can find your project id, at the end of the URL when you go to project details.

https://app.commented.io/projects/{commented-project-id}


2. Initialize Commented in SceneDelegate

In your project, if you're using SceneDelegate bypass step one and implement this step. Navigate to the SceneDelegate.swift file in your project. Import the "CommentedSDK" library by adding the following line at the top of the file:

import CommentedSDK

Inside the scene(_:willConnectTo:options:) function, add the below code to the end of the function.

Commented.shared.start(projectId: "commented-project-id")

You can find your project id, at the end of the URL when you go to project details.

https://app.commented.io/projects/{commented-project-id}

You have now successfully integrated Commented's Mobile SDK into your iOS app, enabling in-app comments and collaboration features for your users.

If you encounter any issues during the integration or have questions about using Commented's Mobile SDK in your iOS app, feel free to contact our support team. We're here to assist you and ensure a smooth integration process.


Did this answer your question?