social.plus’s social SDK provides two types of post deletion: soft delete and hard delete. This flexibility allows developers to choose the appropriate deletion method based on their specific use case and data retention requirements.

Soft Delete

Mark posts as deleted while preserving data for potential recovery

Hard Delete

Permanently remove posts and all associated data from the database

Permission Control

Only post owners and admins can delete posts

Data Management

Choose the right deletion type for your data policies

Deletion Types Overview

Implementation

// Hard Delete a post
do {
    let result = try await postRepository.hardDeletePost(
        withId: "<post-id>", 
        parentId: "<parent-post-id>"
    )
    print("Post hard deleted successfully")
} catch {
    // Handle error here
    print("Failed to hard delete post: \(error)")
}
Default Behavior: If no deletion type is specified in older SDK versions (v5 and below), the default behavior is soft deletion.

Access Levels

Platform Availability

SDK Only: Hard deletion is only supported via the SDK and API at this time and is not yet available in the UIKit or Console. Use the PostRepository to specify the post ID and desired deletion type.

Important Considerations

File Handling: Please note that files attached to posts will not be automatically deleted when the post is deleted. You may need to implement separate file cleanup processes if required.

Best Practices

Common Use Cases

Content Moderation

Remove inappropriate or policy-violating posts

User Privacy

Allow users to remove their own content

GDPR Compliance

Permanently delete user data upon request

Platform Cleanup

Remove spam or test content