ClickCease
Interface with communities

How to implement in-app trending and recommended communities

Italo Orihuela
Italo Orihuela
Engineer
iOS
Nov 1, 2023

Fostering user engagement is key to the success of any application, hence knowing how to recognize trends or recommendations is key. This tutorial will guide you through the process of implementing trending and recommended communities within your iOS app using Amity Social Cloud SDK.

We will delve into the <span id="greylight" class="greylight">getTrendingCommunities</span> and <span id="greylight" class="greylight">getRecommendedCommunities</span> methods, which identify communities with high member activity. These features can significantly enhance user experience by promoting dynamic interaction and fostering a supportive community atmosphere. So, whether you're a seasoned developer or just starting, this guide will provide you with the tools to take your app to the next level.

Pre-requisites

Before we begin, ensure that you have the following:

  1. Basic knowledge of Swift and iOS development.
  2. Xcode installed on your machine.
  3. An active Amity account and the Amity Social Cloud SDK installed in your project.
  4. An Amity Social Cloud Portal account
  5. An Amity Social Cloud Console Account
  6. A UI or access to Amity Social Cloud UI Kits

Note: If you haven’t already registered for an Amity Social Cloud account, we recommend following our comprehensive step-by-step guide in the Amity Portal to create your new network.

Understanding Trending and Recommended Communities

Before we dive into the implementation, it's important to understand what trending and recommended communities are and why they are crucial for increasing user engagement.

A trending community is a community that is currently experiencing high levels of member activity. This could be due to a variety of factors such as a hot topic, a popular event, or a high-profile member. By presenting users with a list of trending communities, your app can help users discover new communities that they might be interested in, thereby promoting greater engagement and interaction.

On the other hand, a recommended community is a community that the user is not currently a part of but is likely to be interested in based on their activity and interests. By recommending communities to users, your app can help users discover new communities that they might not have found on their own, further enhancing user engagement.

Both trending and recommended communities are powerful tools for promoting a more dynamic and engaging user experience, fostering greater collaboration and communication among members, and creating a more supportive and inclusive community atmosphere.

Step 1: Understanding the Methods

The <span id="greylight" class="greylight">getTrendingCommunities</span> method identifies communities with high levels of members, regardless of whether the user is part of them or not. On the other hand, the <span id="greylight" class="greylight">getRecommendedCommunities</span> method identifies communities with high member activity where the user is not a part of. These methods can be used to present users with a list of communities that they might be interested in, thereby promoting greater engagement and interaction.

Step 2: Implementing the getTrendingCommunities Method

To implement the <span id="greylight" class="greylight">getTrendingCommunities</span> method, you need to create an instance of <span id="greylight" class="greylight">AmityNotificationToken</span> and call the <span id="greylight" class="greylight">getTrendingCommunities</span> method on the <span id="greylight" class="greylight">communityRepository</span> object. This will return a collection of trending communities. You can then iterate over this collection to handle each community in the list.

Here's a sample code snippet:

Step 3: Implementing the getRecommendedCommunities Method

The implementation of the <span id="greylight" class="greylight">getRecommendedCommunities</span> method is similar to the <span id="greylight" class="greylight">getTrendingCommunities</span> method. You need to call the <span id="greylight" class="greylight">getRecommendedCommunities</span> method on the <span id="greylight" class="greylight">communityRepository</span> object and handle the returned collection of recommended communities.

Here's a sample code snippet:

Step 4: Handling Errors

It's important to handle any errors that might occur when calling these methods. You can do this by checking the <span id="greylight" class="greylight">error</span> parameter in the callback function. If an error occurs, you can handle it accordingly.

Step 5: Fetching a Maximum of 15 Items

Note that you can fetch a maximum of 15 items from the trending and recommendation communities at once. This limit is set to ensure optimal performance and to prevent overloading the user with too many recommendations at once.

Final Thoughts

By implementing trending and recommended communities in your iOS app, you can significantly enhance user engagement and foster a more dynamic and supportive community atmosphere. Amity Social Cloud makes it easy to implement these features, providing you with powerful tools to take your app to the next level. So, start harnessing the power of trending and recommended communities today and watch your user engagement soar!