Skip to content
GuidesChecked 20 November 2026

Call the feedback API from Swift

List requests, vote, suggest and comment with async functions and handle each typed error your way.

Free for one project and 100 votes. Paid plans start with a 14 day trial, no card.

The shape

Every call is a static function on VoteFirst. It names the thing it acts on and returns what the server answered.

One function for each route, and nothing else.

The project and the voter are never arguments.

Start the package once with your embed key, then call the functions from anywhere on the main actor. The key names your project, so no call asks which board you mean. The voter is minted on the first write, kept in the keychain and sent in a header, so no call asks who is voting either.

An argument that named the voter would let anyone vote as anyone, which is why the package leaves it out. When you need to know who is voting, ask with me() and draw from the answer.

Every call that touches the network is async and throws. Cancelling the surrounding task cancels the request, and the call then throws CancellationError instead of a package error, so a view that disappears mid load never paints an error nobody asked for.

The calls and the route each one reaches
Call on VoteFirstWhat it doesRoute
me()Mints the voter this app writes as, or reads it backPOST identity
board()Reads the project, its columns and what it allowsGET the board root
features(_:)Reads one page of requestsGET features
feature(id:)Reads one requestGET features/{id}
comments(featureID:)Reads one page of a threadGET features/{id}/comments
changelog()Reads one page of releasesGET changelog
release(id:)Reads one releaseGET changelog/{id}
messages()Reads the messages for this platform and app versionGET messages
dismiss(messageID:)Hides a message from this voterPOST messages/{id}/dismiss
upvote(featureID:)Casts a votePOST features/{id}/vote
unvote(featureID:)Takes a vote backDELETE features/{id}/vote
suggest(_:details:)Files a request for approvalPOST features
comment(_:featureID:replyingTo:)Posts a comment or a replyPOST features/{id}/comments
like(commentID:)Likes a comment, or takes the like backPOST comments/{id}/like
delete(commentID:)Removes one of this voter's commentsDELETE comments/{id}
A first load
Task { @MainActor in
    let page = try await VoteFirst.features()
    self.features = page.items
}

Listing

features() with no argument returns the roadmap, most wanted first. Pass a FeatureQuery to narrow it.

Ask for the requests you want, twenty a page.

A query is a value, so a screen can keep one in its state.

A FeatureQuery holds a sort, a scope, a column, tag ids, statuses, a search string, a page number and a page size. The sorts are top, votes, trending, new, oldest, comments and board, and the scopes are the roadmap, one custom board by slug, or every board at once.

Statuses are open, planned, inProgress, done, denied and archived. Branch your code on the status rather than on the column name, because a custom board can name its columns anything and the status stays put.

A page size below 1 is sent as 1 and above 100 is sent as 100. A search of empty text is not sent at all. Asking for a status the board hides returns an empty page, not an error, and denied and archived requests appear only when the project publishes them.

A narrower question
let query = FeatureQuery(
    sort: .trending,
    statuses: [.open, .planned],
    search: "dark mode",
    perPage: 50
)
let page = try await VoteFirst.features(query)

Paging

A list answers a Page with the items and the numbers around them: total, hasMore and nextPage.

Read every page without losing the filter.

query.page(next) copies the query and changes only the page.

The loop below keeps asking until nextPage is nil. Because page(_:) returns a copy with the rest intact, there is no way to turn the page and silently drop a filter.

You rarely need everything at once. A screen usually asks for the first page, shows it, and asks for the next when the reader nears the bottom. So keep the query in your view model and advance it there.

Comments and the changelog page the same way, through page and perPage arguments, and the answer is the same Page type.

All of them
let query = FeatureQuery(sort: .top, statuses: [.open])
var page = try await VoteFirst.features(query)
var everything = page.items
while let next = page.nextPage {
    page = try await VoteFirst.features(query.page(next))
    everything += page.items
}

Voting

upvote(featureID:) casts a vote and unvote(featureID:) takes it back. There is no toggle to guess at.

Two calls, so you always know which one ran.

Both answer a VoteResult with the new state.

The result carries the feature id, hasVoted, voteCount and score. On a project that weights votes the score is the weighted number, and otherwise it equals the count.

Voting twice is not an error, and neither is taking back a vote that is not there. The server answers 409 and the package settles it into the state you asked for, with voteCount nil. A nil count means the number you already hold still stands, and it is also nil when the project hides counts.

A feature that does not exist is a real 404 and does throw, and so does a vote on a closed column. Ask the board first and you can leave the button out instead of catching the refusal.

If you keep Feature values in your own state, feature.applying(result) folds a result back in. A result for another id is ignored and a result with no count leaves the count alone, so you never keep a second table of vote state.

A heart button
Button {
    Task {
        let result = feature.hasVoted
            ? try await VoteFirst.unvote(featureID: feature.id)
            : try await VoteFirst.upvote(featureID: feature.id)
        feature = feature.applying(result)
    }
} label: {
    Label("\(feature.voteCount ?? 0)", systemImage: feature.hasVoted ? "heart.fill" : "heart")
}

Ask the board

board() returns one document about the project: its boards, columns, tags, display settings, theme and what it allows.

Check what is allowed before you draw a button.

It is held after the first call, so every screen can ask for it.

An owner can close one column to votes while the rest of the board stays open, and can turn comments off entirely. A button drawn without asking is refused when pressed, which feels like a bug to the person who pressed it.

Three helpers answer the questions for you. allowsVoting(on:) reads the project setting, the board setting and the column setting, which are three different places a vote can be switched off. allowsComments and allowsSuggestions cover the other two buttons.

Suggestions are always open to your app. The dashboard switch for them closes only the hosted board page, so allowsSuggestions is true in an app. Pass refresh: true to board() when you want a fresh copy instead of the held one.

Before drawing
let board = try await VoteFirst.board()

if board.allowsVoting(on: feature) { /* draw the vote button */ }
if board.allowsComments { /* draw the comment field */ }
if board.allowsSuggestions { /* draw the suggest button */ }

Suggesting

suggest(_:details:) files a request and returns the Feature it created. Both the heading and the details are required.

File an idea, then tell the writer what happens next.

The heading takes 254 characters and the details take 2000.

The details argument defaults to an empty string so the call reads as a sentence, but sending it empty answers validationFailed on the description field. Disable your send button until both boxes hold text and the error never reaches a reader.

A suggestion waits for the owner to approve it, and that includes the person who wrote it. The Feature you get back has isApproved set to false, and reading it by id answers notFound even for the same voter.

So keep the value you were handed and show it, with a line saying the team reads ideas first. Someone who files a request, cannot find it and sees a not found assumes it was lost. The built in form ends with a confirmation for the same reason.

A send action
func send() async {
    guard heading.count > 0, details.count > 0 else { return }
    do {
        let filed = try await VoteFirst.suggest(heading, details: details)
        sent = filed
    } catch {
        problem = error
    }
}

Comments

comments(featureID:) returns the newest first, with each reply nested inside its parent.

Read a thread, answer it, like it, remove it.

Replies are one level deep, and meta.total counts only the top level.

comment(_:featureID:replyingTo:) posts a comment of up to 2000 characters, and the optional last argument makes it a reply. Replying to a reply answers validationFailed on parent_id, so point the reply at the comment that one answers.

like(commentID:) is one route that does both jobs. It likes a comment this voter has not liked and takes the like back if they have. The result tells you which happened with hasLiked and gives you likeCount.

delete(commentID:) removes a comment the voter wrote, which comment.isOwn reports, so show the delete control only when it is true. Deleting a comment that has replies deletes the replies with it, which is why the count can drop by more than one.

Say it, reply, like
let said = try await VoteFirst.comment("Yes please", featureID: 21519)
let reply = try await VoteFirst.comment("Agreed", featureID: 21519, replyingTo: said.id)
let like = try await VoteFirst.like(commentID: said.id)
let gone = try await VoteFirst.delete(commentID: reply.id)

Typed errors

Each call throws a VoteFirstError, so one catch can map a cause to a sentence a person understands.

Every failure is a VoteFirstError you can switch on.

Handle a few per call and the rest in one place.

Voting and unvoting throw notAllowed on a closed column and notFound on a feature that has gone. Suggesting throws validationFailed on the heading or description, and voterBanned for a voter the project has stopped. Commenting adds validationFailed on content or parent_id, and notAllowed when comments are off.

Deleting throws notAllowed on somebody else's comment. Any call can throw network with no connection, rateLimited when it is over budget, and invalidKey after a key has been rotated.

A banned voter can still read, vote and like, while commenting and suggesting are refused. Read banned from me() on launch and replace the comment box with one line, so nobody types a long reply into a field that will refuse it.

A readable message
func message(for error: Error) -> String {
    guard let failure = error as? VoteFirstError else { return "Something went wrong." }
    switch failure {
    case .voterBanned: return "Commenting is switched off for you."
    case .notAllowed: return "This is closed right now."
    case .network: return "No connection. We will send it later."
    default: return "Try again in a moment."
    }
}

No signal

A write made with no connection throws and is kept in a queue on the device.

A write with no network waits and is sent later.

Your own screen sends the queue when the connection returns.

The built in screens send the queue when one appears. A screen you draw yourself reads await VoteFirst.waiting to see how many writes are queued and calls await VoteFirst.send() to put them out. The second call answers how many left the queue.

Neither call can throw, because a queue already on the device has nothing left to fail at. Each write carries an idempotency key, so a retry cannot vote twice.

Show a queued vote as cast at once, and let the number follow later. A vote made through your own screen also reaches a built in screen that is already on a tab, so mixing the two is fine.

When the connection returns
let waiting = await VoteFirst.waiting
if waiting > 0 {
    let sent = await VoteFirst.send()
    print("Sent \(sent) of \(waiting)")
}

What calling the API yourself gives you

Your design, untouched

Every row, button and empty state is yours to draw.

One call per route

Async functions that read like the request they make.

Errors you can switch on

Each refusal has its own case, with no string matching.

From empty view to a working board

Five calls cover the whole screen.

Start the package

Call VoteFirst.start with your embed key when the app launches.

Ask the board

Call board() so you know which buttons to draw.

Load a page

Call features() and put page.items into your state.

Wire the writes

Connect upvote, suggest and comment to your buttons.

Catch the errors

Turn each VoteFirstError into a line a reader understands.

What to know before you build it

  • A suggestion cannot be read back by id until the owner approves it.
  • Details must not be empty, and a heading takes at most 254 characters.
  • The queue drains while the app runs, not in the background.
  • A nil voteCount means keep the count you have, not zero.

What iOS developers ask about the calls

Are the built in screens still needed?

No. The calls work on their own, and they share the key, the voter and the offline queue with the screens, so you can mix both.

Can a call take a voter?

No. The voter is minted on first use and sent in a header, because a voter argument would let anyone vote as anyone.

Which actor do the calls run on?

The main actor. Every call is @MainActor, every network call is async throws, and every model is Sendable.

What if the view disappears during a load?

Cancelling the task cancels the request. The call throws CancellationError, not a VoteFirstError, so you can ignore it.

Why does voting twice not throw?

Nothing is wrong and nothing changed. The package settles the 409 into the state you asked for, with voteCount nil.

Can a fresh suggestion be fetched?

No. It waits for approval, so reading it by id answers notFound. Keep the Feature that suggest returned.

Is a backend needed?

No. The key names the project and each device gets an anonymous voter. Sign your own users in only if you want votes tied to accounts.

What does it cost?

Free needs no card and holds one project and 100 votes. Lite is $9/mo and Pro is $39/mo, each with a 14 day trial and no card to start.

Draw the screen your app deserves

Try the calls on the Free plan, which asks for no card. Past that, Lite costs $9/mo and Pro costs $39/mo, and each begins with a 14 day trial.