Swiftpack.co - hamed8080/chat as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hamed8080.
hamed8080/chat v0.2.3
iOS Chat SDK for communicating with chat server easily.
⭐️ 1
🕓 1 year ago
iOS macOS macCatalyst
.package(url: "https://github.com/hamed8080/chat.git", from: "v0.2.3")

Chat

A Swift Chat SDK which handle all backend communication with Async SDK and Chat Server.

Features

  • ☑ Simplify Socket connection to Async server
  • ☑ Caching system
  • ☑ Static file response
  • ☑ Downlaod / Upload File or Data or Image resumebble
  • ☑ Manage threads and messages
  • ☑ Manage multiple accounts at the same time

Installation

Swift Package Manager(SPM)

Add in Package.swift or directly in Xcode Project dependencies section:

.package(url: "https://pubgi.fanapsoft.ir/chat/ios/chat.git", .upToNextMinor(from: "1.3.2")),

CocoaPods

Because it has conflict with other Pods' names in cocoapods you have to use direct git repo. Add in Podfile:

pod 'Starscream', :git => 'https://github.com/daltoniam/Starscream.git', :tag => '3.1.1'
pod 'Additive', :git => 'http://pubgi.fanapsoft.ir/chat/ios/additive.git', :tag => '1.0.1'
pod 'Mocks', :git => 'http://pubgi.fanapsoft.ir/chat/ios/mocks.git', :tag => '1.0.1'
pod 'Logger', :git => 'http://pubgi.fanapsoft.ir/chat/ios/logger.git', :tag => '1.0.2'
pod "Async", :git => 'http://pubgi.fanapsoft.ir/chat/ios/async.git', :tag => '1.3.1'
pod "ChatCore", :git => 'http://pubgi.fanapsoft.ir/chat/ios/chat-core.git', :tag => '1.0.1'
pod "ChatModels", :git => 'http://pubgi.fanapsoft.ir/chat/ios/chat-models.git', :tag => '1.0.2'
pod "ChatDTO", :git => 'http://pubgi.fanapsoft.ir/chat/ios/chat-dto.git', :tag => '1.0.2'
pod "ChatExtensions", :git => 'http://pubgi.fanapsoft.ir/chat/ios/chat-extensions.git', :tag => '1.0.2'
pod "ChatCache", :git => 'http://pubgi.fanapsoft.ir/chat/ios/chat-cache.git', :tag => '1.0.2'
pod "Chat", :git => 'http://pubgi.fanapsoft.ir/chat/ios/chat.git', :tag => '1.3.2'

How to use?

let asyncConfig = AsyncConfigBuilder()
            .socketAddress("socketAddresss")
            .reconnectCount(Int.max)
            .reconnectOnClose(true)
            .appId("PodChat")
            .serverName("serverName")
            .isDebuggingLogEnabled(false)
            .build()
let chatConfig = ChatConfigBuilder(asyncConfig)
            .token("token")
            .ssoHost("ssoHost")
            .platformHost("platformHost")
            .fileServer("fileServer")
            .enableCache(true)
            .msgTTL(800_000)
            .isDebuggingLogEnabled(true)
            .persistLogsOnServer(true)
            .appGroup("group")
            .sendLogInterval(15)
            .build()
ChatManager.instance.createOrReplaceUserInstance(config: config)
ChatManager.activeInstance?.delegate = self
ChatManager.activeInstance?.connect()

Usage

ChatManager.activeInstance?.getThreads(.init(), completion: { response in
    if let response.result {
        // Write your code here.
    }
}

Documentation

For more information about how to use Chat SDK visit Documentation

Developer Application

For more example and usage you can use developer implementation app

Contributing to Chat

Please see the contributing guide for more information.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics