Messaging Installation - Straas/Straas-iOS-sdk GitHub Wiki
Overview
StraaS Messaging SDK provides a easy way to establish a Real-Time chatroom or message board
StraaSMessagingSDK
only provides non-UI part of a chat room.
We also provides ChatRoom to build Messaging-UI. This chapter will guide you to install whichever you want to use.
Install StraaSMessagingSDK
Requires Swift 4.0/Xcode 9.3 or later.
If you need Swift 3.x/Xcode 9.2(or eariler) use the v0.13.0.
CocoaPods
-
Suggest CocoaPods version upper than 1.1.0
-
Add following lines to your Podfile:
use_frameworks! post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.0' end end end target '<YOUR_TARGET_NAME>' do pod 'StraaS-iOS-SDK/Messaging', '~> 0.7.1' end
-
Then run
pod install
in the command line. (You might need to dopod repo update
beforepod install
.)
Manual Installation
-
Download latest release of StraaS-iOS-SDK.
-
Extract zip file and add
StraaSMessagingSDK.framework
into your project as a linked framework. -
Install AFNetworking
- Installation with Carthage
- Or download
AFNetworking.framework
from AFNetworking releases
-
Install Socket.IO-Client-Swift
- Add
github "socketio/socket.io-client-swift"
toCartfile
- Run
carthage update socket.io-client-swift --platform ios
- You will find
SocketIO.framework
inCarthage/Build/
- Add
-
Add both
AFNetworking.framework
andSocketIO.framework
into your project.
Integrate Chatroom as message UI
To integrate our Message UI example, we suggest to use git submodule to make our UI example as a vendor. This can not only keep you tracking our latest UI update but also make you customized your own UI version.
Before we getting started, make sure you've read the previous chapter Use Chat Room, and set your STSSDKClientID properly.
Install the 3rd party libraries used by our sample into your project
Since Message UI example also use CocoaPods 3rd party libraries to complete a great experience sample, you should add those libraries into your project Podfile too.
target '<#YOUR_TARGET_NAME#>' do
pod 'StraaS-iOS-SDK/Messaging'
pod 'SDWebImage'
pod 'SlackTextViewController'
pod 'TTTAttributedLabel'
end
run Pod install
in command line.
SDWebImage is used to handle cache image and asynchronous downloading.
SlackTextViewController is an awesome message UI library.
You can go to their github page to see what those libraries can achieve and how to modify if you want to build your own feature.
Integration with Submodule
First, you should fork StraaS-iOS-sdk to your github account.
Use command line to go to your project folder which will use our UI example, and do:
- create a folder to manage submodule
mkdir <#your_submodules_files#>
- cd to <#your_submodules_files#> folder
cd <#your_submodules_files#>
- Add StraaS-iOS-sdk you just forked as submodule
git submodule add https://github.com/<#your_github_account#>/StraaS-iOS-sdk StraaS-iOS-sdk
Open your submodule file, you should see StraaS-iOS-sdk
there waiting to serve you.
- Drag the ChatRoom directory into your project.
That's all you have to do. To see how to use message UI, here will tell you more details.