Release v4.0.0 beta

This commit is contained in:
Wooyoung Chung 2022-03-08 21:16:33 -08:00 committed by Minhyuk Kim
commit d4cce74a08
7 changed files with 555 additions and 0 deletions

12
CHANGELOG.md Normal file
View File

@ -0,0 +1,12 @@
# Change Log
### v4.0.0-beta (Apr 12, 2022)
- Codebase has been re-written from Objective-C to Swift.
- Naming of the Product has been changed from `SendBirdSDK` to `SendbirdChatSDK`.
- Naming of the main class has been changed from `SBDMain` to `SendbirdChat`.
- Naming of public interfaces has been renamed to better match Swift's language style guide.
- Deprecated interfaces from v3 has been removed.
- Support for SyncManager has been removed.
### v3.x
- Please refer to the [Changelog v3](https://github.com/sendbird/sendbird-ios-framework/blob/master/CHANGELOG.md).

68
LICENSE.md Normal file
View File

@ -0,0 +1,68 @@
# Sendbird SDK LICENSE
This is an agreement between You ("You") and Sendbird, Inc., the developer of Sendbird, located at 400 1st Ave, San Mateo, CA 94401, ("Sendbird") regarding Your use of the Sendbird SDK and any associated documentation or other materials made available by Sendbird (collectively the "SDK"). This agreement applies to any updates or supplements for the SDK, unless other terms accompany those items. If so, those other terms apply.
By installing, accessing or otherwise using the SDK, You accept the terms of this agreement. If You do not agree to the terms of this agreement, do not install, access or use the SDK.
If You comply with this agreement, You have the rights below.
(1) USE OF THE SDK. Subject to Your compliance with this agreement, Sendbird hereby authorizes You to use the SDK solely for the purpose of creating mobile applications designed to operate with the Services (referred to as "Authorized Applications"). You may not rent, lease or lend any of Your rights in the SDK or access to the Services. You may make a reasonable number of copies of the SDK for the purposes set forth herein, provided that You reproduce only complete copies, including without limitation all "read me" files, copyright notices, and other legal notices and terms that Sendbird has included in the SDK.
(2) SCOPE OF LICENSE. The SDK is licensed, not sold. This agreement only gives You some rights to use the SDK. Sendbird specifically does not grant any express or implied rights under its patents with respect to your Authorized Applications. In doing so, You must comply with any technical limitations in the SDK that only allow You to use it in certain ways. You may not: (a) reverse engineer, decompile, distribute or disassemble the SDK, except and only to the extent that applicable law expressly permits; or (b) make more copies of the SDK than specified in this agreement, except and only to the extent applicable law expressly permits; or (c) publish the SDK for others to copy; or (d) rent, lease or lend the SDK.
(3) USE OF THE SERVICES. Your use of the Services, and the use of the Services by anyone hosting or using your Authorized Application, is governed by the then-current Terms of Services (“TOS”) which can be found at: https://sendbird.com/terms.
(4) EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK.
(5) FEEDBACK. By submitting feedback to Sendbird, either via email at support@sendbird.com or by any other means: You automatically grant to Sendbird a perpetual, irrevocable, transferable, royalty-free license to use Your feedback for any and all purposes without any compensation to You.
(6) TERMINATION. Sendbird reserves the right to discontinue offering the SDK or Services or to modify the SDK or Services at any time in its sole discretion. This Section and Sections 3, 4, 5, 8, 9, 10, 11, and 12 will survive termination of this agreement or any discontinuation of the offering of the SDK or Services along with any other provisions that would reasonably be deemed to survive such events.
(7) RESERVATION OF RIGHTS. You are not authorized to alter, modify, copy, edit, format, create derivative works of or otherwise use any materials, content or technology provided under this agreement except as explicitly provided in this agreement or approved in advance in writing by Sendbird.
(8) MODIFICATIONS; NOTICES. If we change this contract, then we will give you notice before the change is in force. If you do not agree to these changes, then you must cancel and stop using the SDK and Services before the changes are in force. If you do not stop using the SDK or Services, then your use of the SDK or Services will continue under the changed contract. Sendbird may give notices to You, at Sendbird's option, by posting on any portion of sendbird.com or by electronic mail to any e-mail address provided by You to Sendbird.
(9) ENTIRE AGREEMENT. This agreement, and any applicable TOS or contract for Services, are the entire agreement with respect to the SDK or Services.
(10) APPLICABLE LAW AND VENUE. California state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where You live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort. You agree that any action brought under this agreement will be subject to exclusive jurisdiction and venue in the state and federal courts located in San Francisco, California.
(11) DISCLAIMER OF WARRANTY. The SDK is licensed "as-is." You bear the risk of using it. Sendbird gives no express or implied warranties, guarantees or conditions. You may have additional consumer rights under Your local laws which this agreement cannot change. To the extent permitted under Your local laws, Sendbird excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement. Sendbird does not represent or warrant that the SDK or the Services will always be available, uninterrupted, secure, or error free.
(12) LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. You can recover from Sendbird and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages. This limitation applies to:
a. anything related to the SDK, services, or content (including code) on third party Internet sites, or third party programs; and
b. claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
BSD License
For SocketRocket software
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

23
Package.swift Normal file
View File

@ -0,0 +1,23 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "SendbirdChatSDK",
platforms: [.iOS(.v10)],
products: [
.library(
name: "SendbirdChatSDK",
targets: ["SendbirdChatSDK"]
),
],
dependencies: [],
targets: [
.binaryTarget(
name: "SendbirdChatSDK",
url: "https://github.com/sendbird/sendbird-chat-sdk-ios/releases/download/v4.0.0-beta/SendbirdChatSDK.xcframework.zip",
checksum: "7ef3a28a79013503ade9d51ad48db65be2ddaf31722558d3a3b2408442dc0376"
),
]
)

327
README.md Normal file
View File

@ -0,0 +1,327 @@
# [Sendbird](https://sendbird.com) Chat SDK for iOS
[![Platform](https://img.shields.io/badge/Platform-iOS-orange.svg)](https://cocoapods.org/pods/SendBirdSDK)
[![Languages](https://img.shields.io/badge/Language-Objective--C%20%7C%20Swift-orange.svg)](https://github.com/sendbird/sendbird-chat-sdk-ios)
[![CocoaPods](https://img.shields.io/badge/CocoaPods-compatible-green.svg)](https://cocoapods.org/pods/SendBirdSDK)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Commercial License](https://img.shields.io/badge/License-Commercial-brightgreen.svg)](https://github.com/sendbird/sendbird-chat-sdk-ios/blob/master/LICENSE.md)
## Table of contents
1. [Introduction](#introduction)
1. [Requirements](#requirements)
1. [Getting started](#getting-started)
1. [Sending your first message](#sending-your-first-message)
1. [Hiring](#we-are-hiring)
<br />
## Introduction
The Sendbird Chat SDK for iOS allows you to add real-time chat into your client app with minimal effort. Sendbird offers a feature rich, scalable, and proven chat solution depended on by companies like Reddit, Hinge, PubG and Paytm.
<br />
### How it works
The Chat SDK provides the full functionality to provide a rich chat experience, implementing it begins by adding a user login, listing the available channels, selecting or creating an [open channel](https://sendbird.com/docs/chat/v4/ios/guides/open-channel) or [group channel](https://sendbird.com/docs/chat/v4/ios/guides/group-channel), and receive messages and other events through [channel event delegates](https://sendbird.com/docs/chat/v4/ios/guides/event-delegate) and the ability to send a message. Once this basic functionality is in place, congrats, you now have a chat app!
Once this is in place, take a look at [all the other features](https://sendbird.com/features/chat-messaging/features) that Sendbird supports and add what works best for your users.
<br />
### Documentation
Find out more about Sendbird Chat for iOS in [the documentation](https://sendbird.com/docs/chat/v4/ios/getting-started/send-first-message). If you have any comments, questions or feature requests, let us know in the [Sendbird community](https://community.sendbird.com).
<br />
## Requirements
The minimum requirements for Chat SDK for iOS are:
- `Mac OS with developer mode enabled`
- `Xcode`
- `At least one device running iOS 9.0 and later`
- `Swift 5.0 and later` or `Objective-C`
> **Note**: Sendbird server supports Transport Layer Security (TLS) from version 1.0 up to 1.3. For example, in the server regions where TLS 1.3 isnt available, lower versions, sequentially from 1.2 to 1.0, will be supported for secure data transmission.
<br />
## Getting started
The quickest way to get started is by using one of the sample apps from the [samples repo](https://github.com/sendbird/sendbird-chat-sample-ios), create an application in the [Sendbird dashboard](https://dashboard.sendbird.com) and copy the `App ID` to the sample app and youre ready to go.
<br />
## Step by step
### Step 1: Create a Sendbird application from your dashboard
Before installing Sendbird Chat SDK, you need to create a Sendbird application on the [Sendbird Dashboard](https://dashboard.sendbird.com). You will need the `App ID` of your Sendbird application when initializing the Chat SDK.
> **Note**: Each Sendbird application can be integrated with a single client app. Within the same application, users can communicate with each other across all platforms, whether they are on mobile devices or on the web.
<br />
### Step 2: Install the Chat SDK
Installing the Chat SDK is simple if youre familiar with using external libraries or SDKs in your projects. Sendbird Chat SDK can be installed through either [**Swift Packages**](#2-get-started-3-swift-packages), [**CocoaPods**](#2-get-started-3-cocoapods), or [**Carthage**](#2-get-started-3-carthage).
> **Note**: If you don't want to use package managers, check out the [manual installation guide](https://community.sendbird.com/t/ios-how-can-i-install-sendbird-framework-without-using-cocoapods/2885).
### Swift Packages
You can use an Xcode native package manager **Swift Packages** for installation.
1. Open **Xcode**, go to your project's **General** settings tab, and select your project under **Project** in the left column.
2. Go to the **Swift packages** tab and click the **+** button.
<!-- ![Image|Adding a package to your project using Swift Packages](https://static.sendbird.com/docs/chat-ios-getting-started-swift-packages.png) -->
3. When a pop-up shows, enter our github repository address in the search bar. The address is `TODO ADD URL`.
<!-- ![Image|Typing in the repository address of the Chat SDK package](https://static.sendbird.com/docs/chat-ios-getting-started-repository-adress.png) -->
4. Set **Rules** and click **Next**.
<!-- ![Image|Setting rules and options for the Chat SDK package](https://static.sendbird.com/docs/chat-ios-getting-started-rules-setup.png) -->
5. Check `SendbirdChatSDK` in the **Package product** column and click **Finish**. This will establish a **Swift Package Dependency** menu in Xcode.
<!-- ![Image|Creating a dependency between your project and the SendbirdChat package](https://static.sendbird.com/docs/chat-ios-getting-started-package-product-checked.png) -->
### CocoaPods
1. Open a terminal window, move to your project directory, and then create a **Podfile** by running the following command.
```bash
$ pod init
```
2. A **Podfile** will be created in your project folder. Open the **Podfile** and modify the file like the following.
```bash
# platform :ios, '9.0'
target 'YOUR_PROJECT_NAME' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for `YOUR_PROJECT_NAME`
pod SendbirdChatSDK
end
```
3. Then install the `SendbirdChatSDK` framework by running the following command in the same terminal window.
```bash
$ pod install
```
4. In the folder, you will see a new project file in the `.xcworkspace` format. Now you can build your project with the `SendbirdChatSDK` framework in the file.
### Carthage
1. Open a terminal window and add the following line to create a **Cartfile** in your project folder.
```bash
$ touch Cartfile
```
2. Move to your project directory, open the **Cartfile**, and add the following line to your **Cartfile**.
```bash
github "sendbird/sendbird-chat-sdk-ios"
```
3. Run the carthage update command to download Sendbird Chat SDK for iOS.
```bash
$ carthage update
```
4. Once the update is complete, go to your Xcode project's **General** settings tab. Then, open the **<YOUR_XCODE_PROJECT_DIRECTORY>/Carthage/Build/iOS** in the **Finder** window and drag and drop the **SendbirdChatSDK.xcframework** folder to the **Frameworks, Libraries, and Embedded** section in Xcode.
<!-- ![Image|Adding SendbirdChatSDK.xcframework to your Xcode project](https://static.sendbird.com/docs/chat-ios-getting-started-xcode-general-tab.png) -->
### Step 3: Import the Chat SDK
With one simple import statement, you can use all classes and methods in both Swift and Objective-C.
```swift
import SendbirdChatSDK
```
<br />
## Sending your first message
Now that the Chat SDK has been imported, we're ready to start sending a message.
**Note**: The methods in the following steps are all **asynchronous**, excluding the `SendbirdChat.initialize(:)`. This means that when using **asynchronous** methods, client apps must receive success callbacks from Sendbird server through completion delegates in order to proceed to the next step. A good way to do this is the nesting of methods.
### Authentication
In order to use the features of the Chat SDK, you should initiate the `SendbirdChatSDK` instance through user authentication with Sendbird server. This instance communicates and interacts with the server based on an authenticated user account, and then the users client app can use the Chat SDK's features.
Here are the steps to sending your first message using Chat SDK:
<br />
### Step 4: Initialize the Chat SDK
Now, initialize the Chat SDK in the app to allow the Chat SDK to respond to changes in the connection status in iOS client apps. Initialization requires the `App ID`, which can be found in the [Sendbird Dashboard](https://dashboard.sendbird.com).
Before calling the `initialize(params:migrationStartHandler:completionHandler:)` method, create a `InitParams` object with your Sendbird application ID. In the params, you can also determine whether to enable local caching or not.
```swift
let initParams = InitParams(
applicationId: APP_ID,
isLocalCachingEnabled: true,
logLevel: .info
)
SendbirdChat.initialize(params: initParams) {
// Migration starts.
}, completionHandler: { error in
// Migration is completed.
}
```
The `completionHandler` gets the initialization status through different event handlers. The `migrationStartHandler` is called when there's an upgrade in the local database. Meanwhile, the `completionHandler` informs the client app whether the initialization is completed.
If the initialization fails when you set the `isLocalCachingEnabled` to **true**, the SDK will operate normally and change the value of the `isLocalCachingEnabled` to **false**. If you still wish to use the local caching, clear the database using the `clearCachedData(completionHandler:)` and try the initialization again with the `isLocalCachingEnabled` set to **true**.
> **Note**: The `initialize(params:migrationStartHandler:completionHandler:)` method of a `SendbirdChatSDK` instance must be called across a client app at least once. We recommend that you initialize Sendbird Chat SDK through the `application:didFinishLaunchingWithOptions:` method of the `AppDelegate` instance.
<br />
### Step 5: Connect to Sendbird server
After initialization by use of the `init()` method, your client app must always be connected to Sendbird server before calling any methods. If you attempt to call a method without connecting, an `ERR_CONNECTION_REQUIRED (800101)` error would return.
Connect a user to Sendbird server either through a unique user ID or in combination with an access or session token. Sendbird prefers the latter method, as it ensures privacy with the user. The former is useful during the developmental phase or if your service doesn't require additional security.
#### A. Using a unique user ID
Connect a user to Sendbird server using their unique **user ID**. By default, Sendbird server can authenticate a user by a unique user ID. Upon request for a connection, the server queries the database to check for a match. Any untaken user ID is automatically registered as a new user to the Sendbird system, while an existing ID is allowed to log indirectly. The ID must be unique within a Sendbird application, such as a hashed email address or phone number in your service.
This allows you to get up and running without having to go deep into the details of the token registration process, however make sure to enable enforcing tokens before launching as it is a security risk to launch without.
```swift
SendbirdChat.connect(userId: USER_ID) { user, error in
guard let user = user, error == nil else {
return // Handle error.
}
// The user is connected to the Sendbird server.
}
```
#### B. Using a combination of unique user ID and token
Sendbird prefers that you pass the APP ID through the use of a token, as it ensures privacy and security for the users. [Create a user](https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-create-a-user) along with their access token, or [issue an session token](https://sendbird.com/docs/chat/v3/platform-api/user/managing-session-tokens/issue-a-session-token) to pass during connection. A comparison between an access token and session token can be found [here](https://sendbird.com/docs/chat/v3/platform-api/user/managing-session-tokens/issue-a-session-token). Once a token is issued, a user is required to provide the issued token in the `SendbirdChat.connect()` method which is used for logging in.
1. Using the Chat Platform API, create a Sendbird user account with the information submitted when a user signs up your service.
2. Save the user ID along with the issued token to your persistent storage which is securely managed.
3. When the user attempts to log in to the Sendbird application, load the user ID and token from the storage, and then pass them to the `SendbirdChat.connect()` method.
4. Periodically replacing the user's token is recommended to protect the account.
```swift
SendbirdChat.connect(userId: USER_ID, authToken: AUTH_TOKEN) { user, error in
guard let user = user, error == nil else {
return // Handle error.
}
// The user is connected to the Sendbird server.
}
```
<br />
### Step 6: Create a new open channel
Create an open channel using the following codes. [Open channels](https://sendbird.com/docs/chat/v4/ios/guides/open-channel) are where all users in your Sendbird application can easily participate without an invitation.
```swift
let params = OpenChannelCreateParams()
params.name = CHANNEL_NAME
OpenChannel.createChannel(params: params) { channel, error in
guard let channel = channel, error == nil else {
return // Handle error.
}
// An open channel is successfully created.
// Through the openChannel parameter of the callback method,
// you can get the open channel's data from the Sendbird server.
}
```
**Note**: You can also create a group channel to send a message. To learn more, see [Create a channel](https://sendbird.com/docs/chat/v4/ios/guides/group-channel#2-create-a-channel) in the Group channel page.
<br />
### Step 7: Enter the channel
Enter the open channel to send and receive messages.
```swift
OpenChannel.getChannel(url: CHANNEL_URL) { openChannel, error in
guard let openChannel = openChannel, error == nil else {
return // Handle error.
}
// Call the instance method of the result object in the openChannel parameter of the callback method.
openChannel.enter { error in
guard error == nil else {
return
}
// The current user successfully enters the open channel,
// and can chat with other users in the channel by using APIs.
}
}
```
<br />
### Step 8: Send a message to the channel
Finally, send a message to the channel you entered. To learn more about the message type you can send, see [Messages](https://sendbird.com/docs/chat/v3/platform-api/message/message-overview).
```swift
openChannel.sendUserMessage(MESSAGE) { userMessage, error in
guard let userMessage = userMessage, error == nil else {
return // Handle error.
}
// The message is successfully sent to the channel.
// The current user can receive messages from other users through
// the channel(_:didReceiveMessage:) method of an event delegate.
}
```
<br />
### Step 9: Receive a message
Add the `OpenChannelDelegate.channel(_:didReceive:)` [event delegate](https://sendbird.com/docs/chat/v4/ios/guides/event-delegate#2-add-and-remove-a-channel-delegate) using the `SendbirdChat.add(delegate:identifier:)` method so that you can receive the message you just sent to the channel. You can also see the message on our dashboard.
```swift
class ViewController: UIViewController, OpenChannelDelegate {
override func viewDidLoad() {
super.viewDidLoad()
SendbirdChat.add(self, identifier: CLASS_IDENTIFIER) // Replace CLASS_IDENTIFIER with a unique identifier for this delegate.
}
func channel(_ channel: BaseChannel, didReceive message: BaseMessage) {
// A message is received in the channel.
}
}
```
<br />
## We are hiring
At Sendbird, we are a diverse group of humble, friendly, and hardworking individuals united by a shared purpose to build the next generation of mobile & social technologies, across chat, voice, and video, that are changing the way we work and live. We're always looking for great people to join our team. [Check out our careers page](https://sendbird.com/careers) for more information.

23
SendbirdChatSDK.podspec Normal file
View File

@ -0,0 +1,23 @@
Pod::Spec.new do |s|
s.name = "SendbirdChatSDK"
s.version = "4.0.0-beta"
s.summary = "SendBird iOS Framework"
s.description = "Messaging and Chat API for Mobile Apps and Websites"
s.homepage = "https://sendbird.com"
s.license = { :type => 'Commercial', :file => 'LICENSE.md' }
s.authors = {
"Minhyuk Kim" => "minhyuk.kim@sendbird.com",
"Sendbird" => "sha.sdk_deployment@sendbird.com",
"Jed Gyeong" => "jed.gyeong@sendbird.com",
"Woo" => "wooyoung.chung@sendbird.com",
"Celine Moon" => "celine.moon@sendbird.com",
"Erenst Hong" => "ernest.hong@sendbird.com"
}
s.source = { :http => 'https://github.com/sendbird/sendbird-chat-sdk-ios/releases/download/v4.0.0-beta/SendbirdChatSDK.zip', :sha1 => '13bca8338a46657f9679496943af9a5818a8294b' }
s.requires_arc = true
s.platform = :ios, "9.0"
s.documentation_url = 'https://docs.sendbird.com/'
s.ios.vendored_frameworks = "SendbirdChatSDK.xcframework"
s.ios.frameworks = ["UIKit", "CFNetwork", "Security", "Foundation", "Network", "MobileCoreServices", "SystemConfiguration", "CoreFoundation"]
s.ios.library = "icucore"
end

60
generate_package.sh Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
CHECKSUM=''
VERSION=''
while getopts v:c:p:r: flag
do
case "${flag}" in
p) PRODUCT=${OPTARG};;
r) REPO=${OPTARG};;
v) VERSION=${OPTARG};;
c) CHECKSUM=${OPTARG};;
*) error "Unexpected option ${flag}";;
esac
done
if [ -z $PRODUCT ]; then
echo "Product name is required"
exit 1
fi
if [ -z $REPO ]; then
echo "Repository name is required"
exit 1
fi
if [ -z $CHECKSUM ]; then
echo "Checksum is required"
exit 1
fi
if [ -z $VERSION ]; then
echo "Version is required"
exit 1
fi
TEMPLATE="
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: \"$PRODUCT\",
platforms: [.iOS(.v10)],
products: [
.library(
name: \"$PRODUCT\",
targets: [\"$PRODUCT\"]
),
],
dependencies: [],
targets: [
.binaryTarget(
name: \"$PRODUCT\",
url: \"https://github.com/sendbird/$REPO/releases/download/$VERSION/$PRODUCT.xcframework.zip\",
checksum: \"$CHECKSUM\"
),
]
)"
echo -e "$TEMPLATE" > Package.swift

42
generate_podspec.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
VERSION=''
while getopts v: flag
do
case "${flag}" in
v) VERSION=${OPTARG};;
*) error "Unexpected option ${flag}";;
esac
done
echo $VERSION
if [ -z $VERSION ]; then
echo 'Version is required'
fi
TEMPLATE="
Pod::Spec.new do |s|
s.name = 'SendbirdChatSDK'
s.version = \"$VERSION\"
s.summary = 'Sendbird Chat iOS Framework'
s.description = 'Messaging and Chat API for Mobile Apps and Websites'
s.homepage = 'https://sendbird.com'
s.license = 'Commercial'
s.authors = {
'Jed Gyeong' => 'jed.gyeong@sendbird.com',
'Celine Moon' => 'celine.moon@sendbird.com',
'Erenst Hong' => 'ernest.hong@sendbird.com'
}
s.source = { :http => \"https://github.com/sendbird/sendbird-chat-sdk-ios/releases/download/v#{s.version}/SendbirdChatSDK.xcframework.zip\" }
s.requires_arc = true
s.platform = :ios, '9.0'
s.documentation_url = 'https://docs.sendbird.com/'
s.ios.frameworks = ['UIKit', 'CFNetwork', 'Security', 'Foundation', 'Network', 'MobileCoreServices', 'SystemConfiguration', 'CoreFoundation']
s.ios.library = 'icucore'
end
"
echo -e "$TEMPLATE" > SendbirdChatSDK.podspec