Skip to content

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

  1. In XCode, select File > Swift Packages > Add Package Dependency. Enter https://github.com/roxchat/mobile-widget-ios.git in the Choose Package Repository dialog.

  2. On the next page, specify the version resolving rule as Up to Next Major with the latest roxchat-mobile-ui-ios release.

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

  1. Click Build Settings
  2. Find (or search) Preprocessor Macros under Apple LLVM 6.0 - Preprocessing
  3. 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

  1. Add selected code to AppDelegate.swift.

    This code prevent incorrect keyboard behaviour.

        func applicationDidEnterBackground(_ application: UIApplication) {
            WidgetAppDelegate.shared.applicationDidEnterBackground()
        }
    
  2. Set session configuration with associated WMSessionConfig object.

    You must call this method for correct behaviour of Widget.

    WMWidgetBuilder.set(sessionConfig:)
    
  3. 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:)
    
  4. Call WMWidgetBuilder.build() method for having Mobile Widget represented by UIViewController class.