Explain Swift code

Paste Swift from an app or a playground and Vibe explains what it does, optionals included.

Todos.swift

Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.

Vibe25 lines selected

Press Explain it for the sample, or paste your own code first.

What this Swift sample shows

optionals
due: String? holds either a string or nil. due.map { ... } runs the closure only when there is a value, and ?? "" supplies the fallback when there isn't.
protocols
Describable requires a readable summary. Todo meets it with a computed property, so any code that takes a Describable can use a Todo.
closures
{ $0.minutes <= 30 } is a closure, and $0 is its first argument. map(\.title) passes a key path, a shorthand for { $0.title }.

Good to know

  • Structs get a memberwise initializer for free. That is where Todo(title:due:minutes:) comes from.
  • if let undated = ... unwraps the optional that first(where:) returns, so the body only runs when an undated to-do exists. Here it prints Water plants (5 min).
  • quick is ["Water plants"], the only to-do that takes 30 minutes or less.

Watch out: first(where:) stops at the first match. Plan trip has no due date either but is never printed. Use filter to get all of them.

Explain Swift code beside your editor

Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).

Install on Mac

curl -fsSL https://unvibe.site/install.sh | bash

Paste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.

No install warning? Use Unvibe in your browser

Opening the .dmg the first time
  1. Open the .dmg and drag Unvibe to Applications.
  2. Open it once; macOS says it can't verify it. Click Done.
    macOS dialog: Unvibe Not Opened, with Done and Move to Trash
    Real screen, macOS 15
  3. System Settings › Privacy & Security › Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.
    macOS Privacy & Security, Security section: Unvibe was blocked to protect your Mac, with the Open Anyway button
    Real screen, macOS 15

The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open