![]() ![]() Create a custom AttachmentViewCatalog class, this is the class that is responsible for selecting the right view for a message attachment.Create the AttachmentInjectorView class that adds our custom view to the message layout and initialize it with the content.Create a custom view to display the image, and the Imgur logo overlay.You can add it to your project by going to File > Add Packages., pasting the following URL in the search field at the top right: and pressing "Add Package" button.Īfter that we are going to do the following: We're going to render the Imgur logo over images from the domain.ĭownload the Imgur logo and drop the file inside Assets.xcassets using Xcode.Īlso, for this example we will be using Nuke as our Image loading system dependency. For this example, we'll keep it simple and customize the preview for images shared from Imgur. You could use this to embed a shopping cart in your chat, share a location, or perhaps implement a poll. For times like this, we provide two main customization paths: you can either reimplement the entire message component and display a message how you like, or you can use custom attachment views. There may come a time when you have requirements to include things in your chat experience that we don't provide out-of-the-box. We set the channelList as the root of a new UINavigationController and make it the root of our window.The documentation about Querying Channels covers this in more detail. For the filter, we’re specifying all channels of type messaging where the current user is a member. We’re using the default sort option which orders the channels by last_updated_at time, putting the most recently used channels on the top. We use the DemoChannelList component and initialize the channelListController controller with a ChannelListQuery.For more information, see the Tokens & Authentication page. In a real-world application, your authentication backend would generate such a token at login / signup and hand it over to the mobile app. We create and connect the user using nnectUser method and use a pre-generated user token, in order to authenticate the user.This API key points to a tutorial environment, but you can sign up for a free Chat trial to get your own later. We initialize the shared ChatClient using an API key.Add both StreamChat and StreamChatUI packages to the project.Under Dependency Rule go with the "Up to Next Major Version" option and enter 4.0.0 as the version.Paste the following URL in the search field at the top right:.The SDK can also be installed with CocoaPods, you can find more information about that on the SDK doc pages. In this tutorial we are going to use Swift Package Manager as the dependency manager. Your are now ready to start with the tutorial. Select where you want to store your new project and press "Create" button. ![]() Make sure Swift is selected as the language option and press "Next" button.Select Storyboard in the Interface options.To get started with the iOS Chat SDK, open Xcode and create a new project. The completed app for each step of the tutorial is available on GitHub. ![]()
0 Comments
Leave a Reply. |