Modify user profiles including display names, descriptions, avatars, and custom metadata. social.plus SDK provides comprehensive methods to update user information for the currently authenticated user. Image Upload: Before setting an avatar, you must first upload the image file. Refer to the Image Upload guide for detailed instructions.
User Authorization: Only the currently authenticated user can update their own profile information. Administrators may have additional privileges through the Console.
// Build the current user data
let builder = AmityUserUpdateBuilder()
builder.setDisplayName("Batman")
builder.setUserDescription("Hero that Gotham needs")
builder.setAvatar(imageData)

// Add custom metadata
let metadata = ["role": "superhero", "city": "Gotham"]
builder.setMetadata(metadata)

// Update the current user from the builder
client.updateUser(builder) { success, error in
    if let error = error {
        print("Update failed: \(error.localizedDescription)")
    } else {
        print("User updated successfully")
    }
}

Best Practices

Performance Optimization

Batch Updates: When updating multiple user properties, combine them into a single update operation instead of making separate calls for better performance.
Rate Limiting: Be mindful of update frequency to avoid hitting rate limits. Consider implementing debouncing for real-time input fields.

Next Steps