NOV 14, 2026
Building Pictr: a photo app that cannot phone home
Two days, 54 Swift files and an iPhone in the loop: an on-device photo review app whose privacy is a grep, whose learning had to be rebuilt once it was asked an honest question, and whose worst bug only existed on real photos.
The bet was that a photo cleanup app could do everything the paid ones do
without a server, an account, or a single line of networking code, and that
"private" could be a property you check with grep rather than a sentence in
a policy. It held. What did not hold, twice, was the assumption that a green
simulator meant a working app.
Pictr opens on the photos you took on this date in earlier years. Swipe right to keep, left to queue for deletion, and one batch goes to Apple's own confirmation. Around that sit a Lookback view of the whole library by day, week, month or year, an on-device Cleanup that finds similar shots, blur, low quality, documents, screenshots and bursts, and a small model that learns what you delete. It went from an empty directory on 2026-11-13 to a public, MIT-licensed v0.1.1 on 2026-11-14.
What happened
Rules first, because they decided the architecture
Four rules came before any screen:
-
No networking code. Not "no tracking": no
URLSession, noNWConnection, noimport Network. The check is one line and it runs before every commit:the privacy policy, executable grep -rnE "URLSession|NWConnection|import Network|URLRequest|PrivateCloudCompute" Pictr -
Never delete on its own. Every delete is one batch through PhotoKit's
performChanges, which puts Apple's confirmation sheet between the app and the library. Cancelling is a first-class outcome, not an error. -
Honest space math. The word "freed" is banned from the UI. A deleted photo sits in Recently Deleted for 30 days, and an iCloud-only original was never using the phone's storage at all. The app reports queued, moved to Recently Deleted, and not on this iPhone as three separate figures.
-
Favorites are protected. A favorite cannot enter the delete queue from any screen.
The first rule shaped the codebase. Library/ is the only folder that
imports Photos, behind a PhotoLibraryClient protocol. Everything that
decides anything (bucketing, grouping by period, the taste model, streaks)
runs over plain value types, so it is tested with fakes and never touches a
real library. A LibraryScanner actor owns the sized assets off the main
actor. Swift 6 strict concurrency, warnings as errors, no dependencies.
Measuring Vision instead of trusting it
Similar shots, blur and quality come from Apple's Vision framework, and Vision's models do not run in the simulator at all ("Failed to create espresso context"). So those tests are device-only and the thresholds came from measurements on a phone:
- Feature-print distance for near-duplicates was 0.001 to 0.003; the same palette with different content measured 0.48; unrelated photos 0.7 to 1.0. Similar shots group under 0.30 within ten minutes.
- Laplacian sharpness alone called a smooth gradient blurry: it scored 30, close to a genuinely blurry frame at 13. Vision's aesthetics score separated them (0.76 against -0.25), so blurry means low sharpness and a low aesthetics score. A clear sky is no longer a cleanup suggestion.
The learning, and the question that broke it
The first version of "learns your taste" was a logistic regression over ten hand-picked facts about a photo (low quality, soft, screenshot, similar extra, old, low resolution, and so on), with weights pulled toward priors. When the question "what does Teach really do, is it fake?" came, the honest answer was: it is rules with tuning, dressed up as learning. It could not know a photo showed food. Twenty answers barely moved it.
Asking the question also surfaced two real bugs:
- Training only used decisions on photos inside the Cleanup window, 30 days by default. Most On This Day swipes are on photos from previous years, so most decisions taught nothing.
- Confirming a delete removed the record from the decision book, so every photo you actually deleted vanished from the training set.
The rebuild kept the logistic model and added two signals that learn from every decision, anywhere in the library:
- Subject. Vision's on-device classifier tags each decided photo. Per tag, deletes and keeps are tallied weighted by classifier confidence, and a photo scores the smoothed log-odds of its tags. A tag needs about three photos of evidence before it counts. Training examples are scored leave-one-out, so a photo cannot vote for itself.
- Look-alike. The seven nearest decided photos by feature-print distance vote, weighted by closeness.
Both live in a persisted trait store, because a deleted photo cannot be read again. The delete path now captures a photo's traits before handing it to Apple. Suggestions name their reason: "Like the receipt photos you delete".
Apple Intelligence came in as an optional plain-English summary of what was
learned. The iOS 27 SDK ships two language models: SystemLanguageModel,
on device, and PrivateCloudComputeLanguageModel, which is a server. The
second is in the grep above. The no-network rule covers Apple's servers too.
The bug the simulator could not see
After a session of polish the report came back: "settings button doesn't even work". Every simulator test had tapped it successfully.
A read-only UI test on the phone found it in one run. The Today screen shows
a fanned stack of photos drawn scaledToFill. Fill scales an image past its
frame and clipShape hides the overflow, but the overflow still takes
touches. A portrait photo in the stack reached about 165 points above
its card and sat on top of the header's buttons. The simulator's seed photos
were landscape, so nothing overflowed there. The same flaw was in every
thumbnail grid, where a tap could select the neighbour.
The fix was two modifiers: .allowsHitTesting(false) on every fill image and
a contentShape on its container. The lasting change was the test. A
DeviceSmokeTests suite now opens every screen on a real iPhone, asserts the
title and the Settings button share a row on every tab, and never keeps,
queues, favorites or deletes anything, so it is safe to point at a real
library. It caught three more bugs the simulator had passed:
- The "What Pictr has learned" page showed 0 decisions while Settings counted hundreds, because it waited on the scanner actor while the actor measured the whole library.
- Progress showed Reviewed below Kept. The daily activity log started after decisions did, so it could not be the total.
- Ready to Delete reported tens of gigabytes "not on this iPhone" with an empty queue: the figure was every iCloud-only suggestion in the library.
Red, black, and real glass
The interface is red and black Liquid Glass over a slowly drifting
MeshGradient that holds still under Reduce Motion. Text is white or grey
(17.3:1 and 8.3:1 on the black); signal red measures 3.6:1 on that ground,
so it carries graphics and never words. White on a red fill is 5.4:1.
Hand-built glass circles for toolbar buttons looked cheap next to the
system's. Moving the page titles into the toolbar's leading item and letting
the header buttons be native ToolbarItems got Apple's glass, sizing and
press feedback for free, with toolbar(removing: .title) to stop the system
drawing the title a second time.
Going public
Publishing surfaced things no test covered. Every commit carried a personal
email address, which a public repository serves to anyone who appends
.patch to a commit URL. The public repository starts from a single clean
commit under a GitHub noreply address, with the full history kept in a
private archive; nothing was force-pushed. A committed Claude Code settings
file pointed at hooks by absolute home-directory path, so it moved to the
uncommitted local settings. The release itself was stopped by a deploy-gate
hook that refuses a package publish without a named human authorization, and
was run by hand. main is protected: pull requests with a review, linear
history, no force-push, with an admin bypass so a solo maintainer can still
ship.
What it cost
Two days of wall-clock and one iPhone, used constantly. The simulator could not run the models, could not reproduce the hit-testing bug, and could not tell a cheap glass button from a real one. Every one of those needed a person looking at a phone.
The learning cost a rebuild that would not have happened without being asked directly whether it was fake. The first version passed its tests; the tests asserted the arithmetic, not whether the arithmetic was learning anything a person would recognize.
Some numbers are still provisional. The look-alike cutoff of 0.6 sits between measured anchors rather than on a measurement of its own, and the classifier gave the drawn test fixtures low confidence (0.15 to 0.33), so how many real photos clear the 0.3 floor is unmeasured.
What I would do differently
Put a read-only device suite in on the first day, not after a user found a dead button. A simulator run that passes is evidence about the simulator.
Write the "is this fake?" question into the spec of anything called learning, and answer it before shipping: what can the model know, what can it not, and how many examples move it. The honest answer was available from the start and only cost asking.
Start with a noreply commit address. Rewriting history to publish was cheap here because the repository was two days old; it would not be on a two-year one.