SKYKitChat 1.7.0

SKYKitChat 1.7.0

TestsTested
LangLanguage SwiftSwift
License NOASSERTION
ReleasedLast Release Feb 2019
SPMSupports SPM

Maintained by Rick Mak, Steven Chan, carmenlau.



  • By
  • Oursky Ltd.

SKYKitChat

CI Status Version License Platform

Using Skygear Chat iOS SDK

Please reference to Skygear Chat Quick Start guide for how to use SKYKitChat: https://docs.skygear.io/guides/chat/quick-start/ios/

Using Skygear Chat UIKit

UIKit only support Swift 3.2 for now. Swift 4.0 supports are coming.

To use the UIKit comes with Skygear, follow these steps:

1. Include SKYKitChat/UI in PodFile

  pod 'SKYKit', '~> 1.1'
  pod 'SKYKitChat', '~> 1.1'
  pod 'SKYKitChat/UI', '~> 1.1'

Run pod install afterwards

2. Include 3 permissions by adding 3 rows in Info.plist of your XCode project:

  • Privacy - Photo Library Usage Description
    • Recommended Description: The app requires access to your photo library for sending images in chat
  • Privacy - Camera Usage Description
    • Recommended Description: The app requires access to your camera for sending images in chat
  • Privacy - Microphone Usage Description
    • Recommended Description: The app requires access to your microphone for sending voices in chat

3. Open conversation view after creating conversation object

Currently UIKit consist of a built-in conversation view. You can use it after getting the conversation object from Chat API:

let vc = SKYChatConversationViewController()
vc.conversation = conversation // conversation object create from chat sdk
self.navigationController?.pushViewController(vc, animated: true)

Bare minimal sample

A bare minimal example in Swift 3.2, which will display a SKYChatConversationView without the navigation bar, to chat with a User hard-coded its ID.

AppDelegate.swift:

import UIKit
import SKYKit
import SKYKitChat

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        let skygear = SKYContainer.default()

        skygear.configAddress("change me with your Skygear API Endpoint")
        skygear.configure(withAPIKey: "change me with your Skygear API Key")

        skygear.auth.signupAnonymously(completionHandler: { (user, error) in
            skygear.chatExtension?.createDirectConversation(userID: "change me with a user ID in your app", title: "Test Group", metadata: nil, completion: { (conversation, error) in
                let vc = SKYChatConversationViewController()
                vc.conversation = conversation
                self.window?.rootViewController = vc
            })
        })
        return true
    }

If you project is in Objective-C, and you need to use the UI classes, you need to add the generated interface header:

#import <SKYKitChat/SKYKitChat-Swift.h>

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

License

SKYKitChat is available under the Apache License, Version 2.0. See the LICENSE file for more info.

Support

For implementation related questions or technical support, please find us on the official forum or community chat; For bug reports or feature requests, feel free to open an issue in this repo