Implement follow and unfollow functionality for user relationships
The Follow/Unfollow User functionality is the core mechanism for establishing and managing relationships between users in your social platform. This feature enables users to connect with others, creating networks that drive content discovery, engagement, and community building.
Instant Connections
Create meaningful connections between users with simple follow/unfollow actions
Request Management
Support both direct following and request-based workflows
You can follow any user by their user ID. The SDK will handle whether the follow is direct or request-based, depending on your network configuration.
// Follow a user by userIddo { let result = try await userRelationship.follow(withUserId: "<user-id>") let status = result.1.status switch status { case .accepted: print("follow status: accepted") case .pending: print("follow status: pending") case .none: print("follow status: none") case .blocked: print("follow status: blocked") @unknown default: print("follow status: unknown") }} catch { // Handle error here}