Installation

LAST EDIT Feb 16 2021

StreamChat Swift SDK supports:

  • iOS 11 and up

  • MacOS 10.15 and up

StreamChat SDK consists of two frameworks: StreamChat and StreamChatUI

  • StreamChat - the low-level library that connects & communicates with StreamChat backend.

  • StreamChatUI — building on top of StreamChat, it's the full SDK library with all UI components. Styling and deep customizations are all supported out of the box.

CocoaPodsCopied!

To integrate StreamChat into your Xcode project using CocoaPods, add this entry in your Podfile:

1
pod 'StreamChatUI', '~> 3.0-beta.4'

Then run pod install.

If you want to use only StreamChat, you can add this entry in your Podfile:

1
pod 'StreamChat', '~> 3.0'

In any file you'd like to use Stream Chat in, don't forget to import the necessary library:

1
2
3
import StreamChatUI 
// or 
import StreamChat

CarthageCopied!

To integrate Stream Chat into your Xcode project using Carthage, specify it in your Cartfile:

1
github "getstream/stream-chat-swift" ~> 3.0.0-beta.4

Then run: carthage update --platform iOS --new-resolver. It will build the frameworks: StreamChat.framework and StreamChatUI.framework into <Path to your Project>/Carthage/Build/iOS/ from where you can add them to your project and link them with your app target.

Follow with these steps:

  • Open your Xcode project

  • Select the project in the Navigator

  • Select your app target

  • Open General panel

  • Open <Path to your Project>/Carthage/Build/iOS/ in Finder and find StreamChat.framework, drag and drop it into Frameworks, Libraries, and Embedded Content area in Xcode. Do the same for StreamChatUI.framework if you need UI components.

  • After adding libraries, select "Do Not Embed" option in "Embed" section. (Right next to the library name after adding it)

  • Open Build Phases panel in Xcode

  • Click the + button and select New Run Script Phase

  • Set the content to: /usr/local/bin/carthage copy-frameworks

  • Add to Input Files:

    • $(SRCROOT)/Carthage/Build/iOS/StreamChat.framework

    • $(SRCROOT)/Carthage/Build/iOS/Starscream.framework

    • if you need UI components:

      • $(SRCROOT)/Carthage/Build/iOS/StreamChatUI.framework

      • $(SRCROOT)/Carthage/Build/iOS/Nuke.framework

      • $(SRCROOT)/Carthage/Build/iOS/SwiftyGif.framework

  • Add to Output Files:

    • $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/StreamChat.framework

    • $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Starscream.framework

    • if you need UI components:

      • $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/StreamChat.framework

      • $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Nuke.framework

      • $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SwiftyGif.framework

Now you can build your app and use StreamChat.

Swift Package ManagerCopied!

You can directly add dependency in Xcode 11+ using repo url, or in your Package.swift file, add to dependencies:

1
.package(url:'https://github.com/GetStream/stream-chat-swift.git', from: '3.0'),