Rox.Chat Mobile Widget for iOS
What is It?
This component provide simple chat integration, based on Rox.Chat Mobile SDK.
Installation
CocoaPods
To connect the Mobile Widget to your project using CocoaPods, add the following line to the project dependencies list:
pod RoxChatMobileWidget
SPM
-
In XCode, select File > Swift Packages > Add Package Dependency. Enter
https://github.com/roxchat/mobile-widget-ios.git
in the Choose Package Repository dialog. -
On the next page, specify the version resolving rule as Up to Next Major with the latest
roxchat-mobile-ui-ios
release. -
After Xcode checks out the source and resolves the version, you can choose the
Rox.Chat Mobile SDK
component and add it to your app target.
Carthage
Add the following line to your Cartfile:
github "roxchat/mobile-sdk-ios" == 3.0.3
Important Info
If you want to use component in extension, you must set Preprocessor Macros.
- Click Build Settings
- Find (or search) Preprocessor Macros under Apple LLVM 6.0 - Preprocessing
- Add
TARGET_IS_EXTENSION
or any other name of your choice in both the debug and release sections.
Notice that some functions are not allowed when you use app extension.
Usage
-
Add selected code to
AppDelegate.swift
.This code prevent incorrect keyboard behaviour.
func applicationDidEnterBackground(_ application: UIApplication) { WidgetAppDelegate.shared.applicationDidEnterBackground() }
-
Set session configuration with associated
WMSessionConfig
object.You must call this method for correct behaviour of Widget.
WMWidgetBuilder.set(sessionConfig:)
-
Set configurations for Mobile Widget
viewControllers
.If you skip calling these methods Mobile Widget will use default configurations for the
viewControllers
.WMWidgetBuilder.set(chatViewControllerConfig:) WMWidgetBuilder.set(imageViewControllerConfig:) WMWidgetBuilder.set(fileViewControllerConfig:)
-
Call
WMWidgetBuilder.build()
method for having Mobile Widget represented byUIViewController
class.