Guides

Add Report and Block to an iOS App: UX, Server, SwiftUI

Apple's guidelines require apps with user-generated content to offer a way to report content and the ability to block abusive users. Here is how to design both, what the backend has to do with each report, and the Swift code to wire it up.

Report and block are the two buttons that decide whether an app with user-generated content feels safe, and they are also two of the four things Guideline 1.2 asks for. The UI is the easy part; the loop behind it is the work. A report has to land somewhere, someone has to act on it, and a block has to hide content everywhere it could appear.

What Apple asks for

Guideline 1.2 (User-Generated Content) in the App Store Review Guidelines says apps with user-generated content or social networking services must include four things:

  • a method for filtering objectionable material from being posted to the app;
  • a mechanism to report offensive content, and timely responses to concerns;
  • the ability to block abusive users from the service;
  • published contact information so users can easily reach you.

The guideline does not define "timely" or prescribe a design for either button, and it words the third item as blocking abusive users "from the service". That can be read as your own ban, as a per-user block, or as both. This article builds both, because users expect the second and you need the first. Everything below beyond the four bullets is a sensible default, not a spec. The guidelines change, so re-read the page before you submit.

Where the report button goes

Put it on the content itself, one tap away, everywhere that content can appear.

  • Posts, comments, replies and messages: an ellipsis button or a long-press context menu with Report and Block. A context menu alone is easy to miss, so pair it with a visible button on your most common content type.
  • Profiles: a menu with Report user and Block user. Abuse is often about a person, not a single post.
  • Images and video: reachable from the full-screen viewer, not only from the feed.
  • Your own content: hide both actions there. The API rejects a self-block anyway.

Do not bury these in Settings. Settings is the right home for something else: a "Blocked users" screen where people can undo a block.

Report reasons and confirmation

A short list of reasons helps users choose quickly and helps you sort the queue. Seven is plenty: spam or scam, harassment or bullying, hate speech, nudity or sexual content, violence or threats, self-harm or suicide, and something else. Keep them aligned with the categories in your community guidelines, so a moderator can point at a rule when they act. Add an optional free-text field, and keep it optional: a required text box makes people abandon the report.

After submitting, say what happens next and promise only what you can deliver. "Thanks, we will review this" is honest. "We review reports within 24 hours" is a commitment, so write it only if someone will actually look every day. For self-harm reports, consider linking to local help resources on the confirmation screen.

Offer "Also block this user" as a toggle on the same sheet. People who report someone usually want them gone from their feed, and one flow beats two. Hiding the reported item for the reporter right away feels responsive, but make sure it does not suggest the content was removed for everyone.

What happens on the server

The app should send the report to a backend you control, not keep it on the device. Each report needs the content id, the reporter id, the reported user id (to spot repeat offenders), a reason, optional details, and a status with timestamps, so you can show that you responded and how fast. Then three things have to work:

  1. De-duplicate. If the same user reports the same item twice while the first report is open, return the existing report. Many reports from different users on one item are a useful signal; many from one user are noise.
  2. A review queue with real actions. A moderator needs to dismiss a report, remove the content, or remove it and ban the author. Removing content should close every open report on it, or the queue fills with stale items.
  3. A way for the app to learn about removals. If content is removed after other users loaded it, the client has to find out. Check a content status endpoint when rendering or on pull-to-refresh, and drop anything marked removed.

"Timely" is yours to define. Pick a target you can keep, such as reviewing the queue once a day, write it in your community guidelines, and watch the age of the oldest open report. TrustShip's dashboard queue has approve, remove and ban actions for exactly this, and its content status endpoint tells the app when something was removed.

Blocking semantics

A block is personal and immediate: it changes what one user sees and should not need a moderator. A ban is your decision, applies to the whole service, and belongs on your server (the ban endpoints should never be callable from the app). Do not mix them up. A reasonable block behaves like this:

  • Hide in both directions. After A blocks B, A no longer sees B's posts, replies, profile or messages, and B no longer sees A's. Otherwise B can keep replying under A's posts. The guidelines do not spell this out, but users expect it.
  • Hide everywhere. Feeds, comment threads, search, mentions, notifications, suggestions and direct messages. The classic bug is blocking in the feed and forgetting the notification list.
  • No notification. Do not tell B they were blocked.
  • Reversible. A "Blocked users" list with an unblock button.
  • Enforced on the server where it matters. Client-side filtering is fine for feeds, but for direct messages the server should refuse delivery, since a modified client can ignore a local filter.

One catch: a block list returned for a user covers one direction only, the users that person blocked. If you want the reverse ("who has blocked me"), your backend needs its own lookup.

The Swift side

Built by hand, the client call is a plain JSON POST. This sketch assumes your own backend authenticates the user and relays the call, so no secret key ships in the app:

// userSessionToken: your own session token for the signed-in user
struct ReportBody: Encodable {
    let content_id: String
    let reporter_user_id: String
    let reason: String
    let details: String?
}

func sendReport(_ body: ReportBody) async throws {
    var request = URLRequest(url: URL(string: "https://api.example.com/v1/reports")!)
    request.httpMethod = "POST"
    request.setValue("Bearer \(userSessionToken)", forHTTPHeaderField: "Authorization")
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    request.httpBody = try JSONEncoder().encode(body)

    let (_, response) = try await URLSession.shared.data(for: request)
    guard let http = response as? HTTPURLResponse, (200..<300).contains(http.statusCode) else {
        throw URLError(.badServerResponse)
    }
}

The guard accepts any 2xx, so a created report (201) and a duplicate that returns the existing one (200) both count as success. Make your own endpoint behave the same way.

TrustShip's Swift SDK is a single file you drag into your target (iOS 15+, no dependencies). It includes a SwiftUI ReportSheet with a reason picker, optional details, an "Also block this user" toggle and a confirmation:

struct PostRow: View {
    let postId: String
    let authorId: String
    let text: String
    let currentUserId: String
    @State private var isReporting = false

    var body: some View {
        Text(text)
            .contextMenu { Button("Report") { isReporting = true } }
            .sheet(isPresented: $isReporting) {
                ReportSheet(client: trustship, contentId: postId,
                            reporterUserId: currentUserId, reportedUserId: authorId)
            }
    }
}

The sheet's success text is hard-coded in the file as "Thanks. We review reports within 24 hours." Since you own the copied file, edit that line if 24 hours is not a promise you can keep.

To hide blocked users, load the list once, keep it in a set and filter before rendering. The SDK has block(blockerUserId:blockedUserId:), unblock(blockerUserId:blockedUserId:) and blockedUserIds(for:):

@MainActor
final class FeedModel: ObservableObject {
    @Published var posts: [Post] = []
    private var blocked: Set<String> = []

    func refresh(me: String) async {
        blocked = Set((try? await trustship.blockedUserIds(for: me)) ?? [])
        let all = await api.loadPosts()
        posts = all.filter { !blocked.contains($0.authorId) }
    }

    func block(_ authorId: String, me: String) async {
        try? await trustship.block(blockerUserId: me, blockedUserId: authorId)
        blocked.insert(authorId)
        posts.removeAll { $0.authorId == authorId }
    }
}

To react to moderator removals, call contentStatus(contentId:) and check shouldHide, which is true once the content was removed or blocked by the filter.

One warning from the SDK itself: do not ship a project API key in a release build. Anything in an app binary can be extracted, and that key also authorizes the ban endpoints. Point baseURL at your own backend, authenticate the user there, and forward only the report, block and status calls.

Before you submit

  • Report is reachable from every kind of content and from profiles, in one or two taps.
  • Reports reach a queue a human reads, and the app can see removals.
  • Block hides content in feeds, threads, search, notifications and messages, in both directions.
  • A "Blocked users" screen with unblock exists.
  • Contact details are published in the app, and your community guidelines explain how to report and block.
  • Extra obligations, for example around minors or illegal content, depend on where you and your users are. Check with a lawyer.

Report and block, ready to wire up

TrustShip gives you the report and block endpoints, a review queue and a SwiftUI report sheet, plus a free plan to try it on your app.

Start free