

# 開始使用 IVS 聊天用戶端傳訊 iOS SDK
<a name="chat-ios-getting-started"></a>

我們建議您透過 [Swift Package Manager](#chat-ios-install-sdk-swiftpm) 來整合開發套件。您也可以使用[手動整合架構](#chat-ios-install-sdk-manual)。

整合開發套件後，您可以在相關的 Swift 檔案最上方新增下列程式碼以匯入開發套件：

```
import AmazonIVSChatMessaging
```

## Swift Package Manager
<a name="chat-ios-install-sdk-swiftpm"></a>

若要在 Swift Package Manager 專案中使用 `AmazonIVSChatMessaging` 程式庫，請將其新增至套件和相關目標的相依性：

1. 從 [https://ivschat.live-video.net/1.0.1/AmazonIVSChatMessaging.xcframework.zip](https://ivschat.live-video.net/1.0.1/AmazonIVSChatMessaging.xcframework.zip).下載最新版本的 `.xcframework`。

1. 在您的終端機中執行：

   ```
   shasum -a 256 path/to/downloaded/AmazonIVSChatMessaging.xcframework.zip
   ```

1. 取得上一步的輸出，並將其貼到專案 `Package.swift` 檔案中 `.binaryTarget` 的 Checksum 屬性內，如下所示：

   ```
   let package = Package(
      // name, platforms, products, etc.
      dependencies: [
         // other dependencies
      ],
      targets: [
         .target(
            name: "<target-name>",
            dependencies: [
               // If you want to only bring in the SDK
               .binaryTarget(
                  name: "AmazonIVSChatMessaging",
                  url: "https://ivschat.live-video.net/1.0.1/AmazonIVSChatMessaging.xcframework.zip",
                  checksum: "<SHA-extracted-using-steps-detailed-above>"
               ),
               // your other dependencies
            ],
         ),
         // other targets
      ]
   )
   ```

## 手動安裝
<a name="chat-ios-install-sdk-manual"></a>

1. 從 [https://ivschat.live-video.net/1.0.1/AmazonIVSChatMessaging.xcframework.zip](https://ivschat.live-video.net/1.0.1/AmazonIVSChatMessaging.xcframework.zip) 中下載最新版本。

1. 解壓縮封存檔的內容。`AmazonIVSChatMessaging.xcframework` 包含用於裝置和模擬器的 SDK。

1. 內嵌擷取的 `AmazonIVSChatMessaging.xcframework`，方法是將其拖曳至應用程式目標的 **General** (一般) 索引標籤的 **Frameworks, Libraries, and Embedded Content** (架構、程式庫和內嵌內容) 區段：  
![\[您的應用程式目標的一般索引標籤的架構、程式庫和內嵌內容區段。\]](http://docs.aws.amazon.com/zh_tw/ivs/latest/ChatUserGuide/images/Chat_SDK_iOS_Manual_Installation.png)