Skip to main content
Call getCommunity() with a community ID to retrieve the community’s name, description, avatar, member count, join status, and settings. The result is a Live Object that updates automatically when the community changes. Membership is not required to retrieve community data.

Community Details

Access name, description, avatar, and basic community information

Membership Data

View member counts, join status, and community accessibility

Live Updates

Real-time synchronization of community changes and member activity

Preview Mode

Retrieve community data without joining
Community data is returned as Live Objects that automatically update when changes occur, ensuring your UI stays synchronized with the latest community information, member counts, and settings.

Get Community by ID

The getCommunity() method retrieves detailed community information using the community ID, returning a Live Object that observes real-time updates including member counts, community settings, and metadata changes.

Parameters

ParameterTypeRequiredDescription
communityIdStringYesUnique identifier of the community to retrieve
var token: AmityNotificationToken?

func getCommunity(communityId: String) {
    token = communityRepository.getCommunity(withId: communityId).observe { liveObject, error in
        if let error = error {
            print("Error retrieving community: \(error)")
            return
        }
        
        guard let community = liveObject.snapshot else {
            print("Community not found")
            return
        }
        
        // Access community information
        print("Community ID: \(community.communityId)")
        print("Name: \(community.displayName)")
        
        // Handle the community data in your UI
        updateCommunityUI(with: community)
    }
}

Query Communities

Discover communities through search and filtering

Join Community

Learn how to implement community membership actions

Community Categories

Understand community organization and categorization

Trending Communities

Implement community recommendation features