Lets integrate our SDK in few minutes

Quick Start#
Download UIKit SDK
Download

UI Kit for iOS#

With MirrorFly UIKit for iOS, you can easily build an in-app chat with all the essential messaging features.

The MirrorFly UIKit for iOS is now available for you to build and customize views at a component level through modularization.

UIKit allows you to execute key chat functions using a view controller, which is composed of a module and a view model. While the module creates and displays the UI, the view model processes and updates relevant data from Chat SDK in each view. The view controller acts as the fundamental starting point of UIKit by allowing you to create and manage your UI.

Requirements#

The minimum requirements for Chat SDK for iOS

  • iOS 12.1 or later

SDK License Key#

Your SDK must be authenticated by MirrorFly server using License Key.

Please follow below step to get your license key:

Step 1: Create an account here in MirrorFly console, if you already have an account please goto step 3.

Step 2: Validate your account by following the steps provided in console and login to your account.

Step 3: Please login to your account here

Step 4: Copy license key under "Application info" in "Overview" page

Get Started#

You can start building a messaging experience in your app by installing MirrorFly UIKit. Along with the UIKIT, you can also install all the core sdks of mirrorfly (downloadable in here )

Step 1: Create a Project

To get started, open Xcode, create a new Swift Project

CreateNewProject

Step 2: Install UIKit

You can import xcframework of UIKIT (downloadable in the top of this page) and all the other core SDKs of MirrorFly (downloadable in here ) into your project.

Goto Project -> Target -> General -> Frameworks,libraries and Embedded Content -> Select Embed & Sign for all the Chat SDK's xcframeworks

xcframework

Step 3: Now, disable the bitcodes for your project

Goto Project -> Build Settings -> Filter the term `Bitcode` -> and select No from the dropdown

bitcode

Step 4: If you have not initiated any pods project before, then initiate the one. Now, add the required pods that are necessary for the SDK to execute the process perfectly.

pod 'Alamofire'
pod 'XMPPFramework/Swift'
pod 'Toaster'
pod 'Firebase/Auth'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'SDWebImage'
pod "BSImagePicker", "~> 3.1"
pod 'libPhoneNumber-iOS'
pod 'NicoProgress'
pod 'SocketRocket'
pod 'Socket.IO-Client-Swift', '~> 15.2.0'
pod 'GoogleWebRTC' # WebRTC for Calls
pod 'RealmSwift', '10.20.1'

Add the below given pod hook code block at the end of the pod file and thus, finally install the pods.

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.1'
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end

Step 5: Now, enable all the below mentioned capabilities into your project.

Goto Project -> Target -> Signing & Capabilities -> Click + at the top left corner -> Search for the capabilities below
Capabilities
App Groups

AppGroups

Note : You should set your own container id through FlyUIKitConstants.CONTAINER_ID = "Your own App Group ID"

Step 6: Initialize with License Key

To integrate and run Mirrorfly UIKit in your app, you need to initialize it first. Initialize the MirrorFlyUI instance through your view controller.

Initialize

func initialize () {
FlyUIKitSDK.shared.initialization(userID: userId, licenseKey: licenseKey) {(isSuccess, error) in
if isSuccess{
self.getRecentChat()
} else {
print(error)
}
}
}

The initialisation should be done with two parameters as below

ArgumentTypeDescription
userIDStringUnique UserID of the User
licenseKeyStringLicenseKey provided by MirrorFly
CALLBACKCompletion Handler used to observe the action status with arguments as result - String, error - String

Step 7: Displaying RecentChat List

MFUIRecentChatListViewController is the starting point for launching UIKit in your app. Using the below code, you can fetch the complete list of the Recent Chats.

ViewController

func getRecentChat() {
let recentChatListViewController = MFUIRecentChatListViewController()
recentChatListViewController.isInitialLoading = true
self.navigationController?.pushViewController(recentChatListViewController, animated: true)
}

RecentChatLight

Step 8: Send Your First Message

You can now run the app on a simulator or a plugged-in device. To send a message, you must first create a chat either single or group chat by tapping the icon in the top-right corner.

After the slection of the chat type, the app lands into the Contacts page with the all the registered users using the same license key. Then, you can select users you wish to start your chat with. Once the chat room has been created, enter your first message and send.

ChatLight

You've successfully sent your first message with MirrorFly.