<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bazi</title>
    <description>The latest articles on DEV Community by Bazi (@bazibuilds).</description>
    <link>https://dev.to/bazibuilds</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4210917%2Fd95749c9-d797-40dc-b2e8-e0091a9aa231.png</url>
      <title>DEV Community: Bazi</title>
      <link>https://dev.to/bazibuilds</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bazibuilds"/>
    <language>en</language>
    <item>
      <title>0 strings missing, still English on screen: taking a SwiftUI app to 12 languages</title>
      <dc:creator>Bazi</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:46:03 +0000</pubDate>
      <link>https://dev.to/bazibuilds/0-strings-missing-still-english-on-screen-taking-a-swiftui-app-to-12-languages-48ah</link>
      <guid>https://dev.to/bazibuilds/0-strings-missing-still-english-on-screen-taking-a-swiftui-app-to-12-languages-48ah</guid>
      <description>&lt;p&gt;I make Alcove, a to-do list, planner and notes app for Mac, iPhone and iPad, written in SwiftUI. It is my own app, so read this as a build story, not a review. Version 1.4, out now on Mac, iPhone and iPad, added 11 languages to English: German, French, Spanish, Italian, Portuguese (Brazil), Dutch, Japanese, Korean, Simplified and Traditional Chinese, and Hindi.&lt;/p&gt;

&lt;p&gt;Two things up front. The translations were made by AI: Claude, called from a Python script, then reviewed and polished by more Claude passes. No human native speaker has checked them. And the code was written with Claude as a coding partner (the commits carry its Co-Authored-By line). This post was written by an AI agent too, drafted from those commits.&lt;/p&gt;

&lt;p&gt;At one point the status command printed 0 missing in all 11 languages. At the same time, the screen of finished tasks was titled "OK" in French, buttons were still in English, and "Aujourd'hui" broke into "Aujo urd' hui". This post is about the gap between those two facts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pipeline in brief
&lt;/h2&gt;

&lt;p&gt;There are eight String Catalogs: a &lt;code&gt;Localizable.xcstrings&lt;/code&gt; for the Mac app, the iOS app, the widgets, the share extension and the TaskKit package, two &lt;code&gt;InfoPlist.xcstrings&lt;/code&gt; for permission prompts, and &lt;code&gt;AppShortcuts.xcstrings&lt;/code&gt; for Siri. &lt;code&gt;Tools/i18n/sync-strings.sh&lt;/code&gt; builds both apps with &lt;code&gt;SWIFT_EMIT_LOC_STRINGS=YES&lt;/code&gt; and merges what the compiler collected with &lt;code&gt;xcstringstool sync&lt;/code&gt;. Today the catalogs hold 2,288 distinct keys between them.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;translate.py&lt;/code&gt; sends only the strings that lack a translation, in chunks of 60 by default, through the Message Batches API. Every request carries a glossary of 83 terms per language, which the model generated once and which every prompt then marks "use exactly". A few rows from &lt;code&gt;glossary.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"de"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"Quick add"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Schnell hinzufügen"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"Inbox"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Eingang"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"Pin (verb)"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Fixieren"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"fr"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"Quick add"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Ajout rapide"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"Done"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"OK"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"ja"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"Quick add"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"クイック追加"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"Due (as in \"Due today\")"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"期限"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every reply is checked before it is written back: the same format specifiers as the English (&lt;code&gt;%@&lt;/code&gt;, &lt;code&gt;%lld&lt;/code&gt;), &lt;code&gt;${applicationName}&lt;/code&gt; as many times, no em-dashes. A string with one integer count must come back with one form per CLDR plural category:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# CLDR also has "many" for fr/es/it/pt; it is left out on purpose,&lt;/span&gt;
&lt;span class="c1"&gt;# Foundation falls back to "other", and generated "many" forms read oddly.&lt;/span&gt;
&lt;span class="no"&gt;PLURALS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'de'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'one'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'other'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'fr'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'one'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'other'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ja'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'other'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'hi'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'one'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'other'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A failed row is retried once, then reported. Then a review pass made 297 corrections and a "native-speaker polish" pass made 2,784 rewrites. Both are Claude again; the polish prompt asks it to read as "a native speaker who uses an iPhone and Mac every day". A second review made 62 more corrections, and 148 long labels were shortened. Last, a blind audit: Claude, prompted as a strict native-speaker grader and not told the strings were machine translated, graded 50 random strings per language as 93.5% native, 6.4% acceptable and 0.2% wrong (one string, fixed). That is a model grading a model. My own notes say a native speaker's read is still worth having before calling any language perfect.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;translate.py status&lt;/code&gt; now said 0 missing everywhere. Here is what that number could not see.&lt;/p&gt;

&lt;h2&gt;
  
  
  A word is not a meaning
&lt;/h2&gt;

&lt;p&gt;The screen of finished tasks is called "Done". So is the button that closes a sheet. Both used the same key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;done&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;localized&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Done"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The glossary, rightly for a button, says "Done" is "OK" in French. So the finished-tasks screen in French and Spanish was titled "OK". The screen of tasks still to do, "Open", was German "Öffnen", the verb. An AI assistant's "Read" permission was "Vorlesen", which means reading aloud. Both AI review passes ran before this was fixed and kept all three, because a reviewer that sees only "Done" has no way to know which one it is.&lt;/p&gt;

&lt;p&gt;The fix is a key per meaning, with a note:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;localized&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"scope.open"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;defaultValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Open"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bundle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;taskKit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Title of the screen of tasks still to do (open, not finished). An adjective, not the verb."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;translate.py&lt;/code&gt; hands that comment to the model as context. Now "Open" is "Offen" in German and "À faire" in French, and "Done" is "Erledigt" and "Terminées". The same pattern came back later: "View" on an attachment needed its own key, because the noun "Darstellung" is the Mac's View menu. And it runs the other way too: Dutch "Attach…" had come out as "Voeg toe…", the same words as "Add…". It is "Bijvoegen…" now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Text the compiler never extracted
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Text("Done")&lt;/code&gt; is collected by the compiler. Alcove's shared components are not so lucky:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;PillButton&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;PillStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;muted&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A literal passed to a plain &lt;code&gt;String&lt;/code&gt; is shown as written, in English, in every language. The first finder, &lt;code&gt;find-unlocalized.py&lt;/code&gt;, asked whether a literal's text was in some catalog. That had already led to about a thousand literals being wrapped. But "Tomorrow" was translated elsewhere, so this line passed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="nc"&gt;UpcomingRow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;TaskRowModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;UUID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;localized&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Send the invoice"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Tomorrow"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Screenshots of the phone in all 11 languages showed what was left. A UI test, &lt;code&gt;LanguageShotsUITests&lt;/code&gt;, run once per language with &lt;code&gt;xcodebuild ... -testLanguage de -testRegion DE&lt;/code&gt;, walks the main screens and attaches a picture of each.&lt;/p&gt;

&lt;p&gt;The new finder, &lt;code&gt;find-unextracted.py&lt;/code&gt;, asks the compiler instead. Every literal that reached a localizing API is in a &lt;code&gt;.stringsdata&lt;/code&gt; file with its file, line and column, so a user-facing literal at any other position is shown in English. About 500 more were wrapped.&lt;/p&gt;

&lt;p&gt;Then the Mac was photographed in all 12 languages and showed English that the phone pass and the finder had both missed: "+ New task", "On", the Settings title. The finder only looked at literals that start like a label, with a capital letter, so it learned about labels led by a symbol, "iCloud" or an emoji, and two-letter words. The App Store screenshots found four more, the Overview widget's lowercase captions ("today", "pending", "upcoming", "total"). Each pass found what the one before could not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sentences built from pieces, and hand-made plurals
&lt;/h2&gt;

&lt;p&gt;This is how the delete warning for a list or folder was put together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;taskWords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"task"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"\(tasks.count) tasks"&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Its \(taskWords) \(tasks.count == 1 ? "&lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="s2"&gt;" : "&lt;/span&gt;&lt;span class="n"&gt;are&lt;/span&gt;&lt;span class="s2"&gt;")"&lt;/span&gt;
&lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"\(subject) deleted with it. \(undo)"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No language can translate "is" without the rest of the sentence. Now each case is a whole sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="n"&gt;gone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;localized&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Its task is deleted with it."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
              &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;localized&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Its \(t) tasks are deleted with it."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The selection bar did "Delete (count) (noun)s?". It is now a &lt;code&gt;SelectionNoun&lt;/code&gt; enum with a whole sentence for each kind ("Delete (count) tasks?", "Delete (count) notes?"), because, as its doc comment says, other languages change more than an ending. The catalog holds the plurals (trimmed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"%lld tasks selected"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"de"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"variations"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"plural"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"one"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"stringUnit"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"value"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"%lld Aufgabe ausgewählt"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"other"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"stringUnit"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"value"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"%lld Aufgaben ausgewählt"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"ja"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"stringUnit"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"value"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"%lld件のタスクを選択中"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;English needs a "one" form too, or "(count) tasks selected" reads "1 tasks selected": &lt;code&gt;translate.py&lt;/code&gt; asks the model for the singular of every count string, and 92 English strings have one now. &lt;code&gt;merge-literals.py&lt;/code&gt; joins literals added across lines (&lt;code&gt;"first half " + "second half"&lt;/code&gt;), so a sentence is one key. The day in Siri's confirmation, &lt;code&gt;"on " + f.string(from: date)&lt;/code&gt;, became one string with a comment: "A due day in a spoken sentence".&lt;/p&gt;

&lt;h2&gt;
  
  
  Layouts that broke in French and Dutch
&lt;/h2&gt;

&lt;p&gt;Longer words found every fixed width. In the Mac menu bar card, French and Dutch broke "Today" inside the word ("Aujo urd' hui"), and German broke the add button ("NEUE AUFGAB E"). The fix is to decide what gives way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The weekday gives way first, then the title shrinks a little.&lt;/span&gt;
&lt;span class="nc"&gt;ViewThatFits&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;horizontal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;HStack&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alignment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;spacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Space&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;md&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Today"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;textStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Typo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;titleS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Theme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textPrimary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fixedSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nc"&gt;Eyebrow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;todayWeekday&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fixedSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Space&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Today"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;textStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Typo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;titleS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Theme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textPrimary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lineLimit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;minimumScaleFactor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the footer, the links fold to symbols so the add button keeps its words. From the phone pass: the counter captions on Today ("ÉCHÉANCE AUJOURD'HUI") wrap at one shared height, priority chips shrink for "Dringend" or "अत्यावश्यक", and the meeting notes card stacks its two buttons with &lt;code&gt;ViewThatFits&lt;/code&gt; when they do not fit side by side. The Overview widget's captions ran past their columns ("DEMNÄCH…"), and there the fix was shorter words: "bald", "du jour", "abiertas", "gepland", "abertas".&lt;/p&gt;

&lt;h2&gt;
  
  
  Siri phrases and widgets
&lt;/h2&gt;

&lt;p&gt;Siri answers only the phrases in &lt;code&gt;AppShortcuts.xcstrings&lt;/code&gt;, while Settings shows its own list of phrases from TaskKit. Translated separately, they would disagree. &lt;code&gt;shortcut-phrases.py&lt;/code&gt; builds Siri's sets from the Settings list's translations, so a person in Germany is shown exactly the phrases Siri listens for. Each translation must name "Alcove" exactly once, and gets Siri's &lt;code&gt;${applicationName}&lt;/code&gt; token back.&lt;/p&gt;

&lt;p&gt;Two English phrases can come out as one. The code comment's example: "New task in" and "Create a task in" were both "Neue Aufgabe in". Siri needs each phrase once, so sets drop repeats, and English's ten ways to add a task are nine in German and eight in French. &lt;code&gt;bundle-check.py&lt;/code&gt;, which reads the compiled tables inside the built apps and extensions, then had to hold a phrase set to being there, not to English's count.&lt;/p&gt;

&lt;p&gt;Widgets had their own English: the sample tasks in the widget gallery, "Tomorrow" in Upcoming, and the Overview captions, which got keys of their own because "today" and "total" are also words in other sentences.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would do first next time
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Give every word that can mean two things its own key and a comment from day one. "Done", "Open", "Read", "View" and "Block" each cost a fix after translation.&lt;/li&gt;
&lt;li&gt;Write whole sentences with the count in them, never &lt;code&gt;n == 1 ? "" : "s"&lt;/code&gt; or &lt;code&gt;+&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make shared components' callers pass &lt;code&gt;String(localized:)&lt;/code&gt;, and run the position-based finder before believing any "0 missing".&lt;/li&gt;
&lt;li&gt;Take screenshots of every screen in every language before the review passes, not after. Each round of pictures found English or broken layouts that the numbers did not.&lt;/li&gt;
&lt;li&gt;Get a native speaker to read it. AI graders gave these translations good marks, but that is not the same thing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One known limit stays: quick add reads English date words ("tomorrow", "every monday", &lt;code&gt;!high&lt;/code&gt;) in every language.&lt;/p&gt;

&lt;p&gt;Alcove on the App Store: &lt;a href="https://apps.apple.com/app/id6817797913?pt=128735707&amp;amp;ct=devto&amp;amp;mt=8" rel="noopener noreferrer"&gt;https://apps.apple.com/app/id6817797913?pt=128735707&amp;amp;ct=devto&amp;amp;mt=8&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>swiftui</category>
      <category>ios</category>
      <category>localization</category>
    </item>
    <item>
      <title>Soft delete on iOS: nothing leaves the photo library until the user empties Trash</title>
      <dc:creator>Bazi</dc:creator>
      <pubDate>Tue, 03 Nov 2026 12:43:34 +0000</pubDate>
      <link>https://dev.to/bazibuilds/soft-delete-on-ios-nothing-leaves-the-photo-library-until-the-user-empties-trash-3eol</link>
      <guid>https://dev.to/bazibuilds/soft-delete-on-ios-nothing-leaves-the-photo-library-until-the-user-empties-trash-3eol</guid>
      <description>&lt;p&gt;&lt;em&gt;I make Swept, a free iPhone photo cleaner with ads; this is how its Trash works. Excerpts are from the real code, trimmed, with a few comments shortened.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A swipe-to-clean app has a built-in mismatch. A swipe takes a fraction of a second and people do hundreds in one sitting. Deleting from the photo library is heavier, and iOS guards it. Apple's documentation for &lt;a href="https://developer.apple.com/documentation/photos/phphotolibrary/performchanges(_:completionhandler:)" rel="noopener noreferrer"&gt;&lt;code&gt;performChanges(_:completionHandler:)&lt;/code&gt;&lt;/a&gt; says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For each call to this method, iOS shows an alert asking the user for permission to edit the contents of the photo library. If your app needs to submit several changes at once, combine them into a single change block.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So "delete on swipe" was never an option: that's a system alert per card. Swept does the opposite. A left swipe writes one row to a local SwiftData store and nothing else. The photo library only changes when the user opens Trash and empties it, all in one go.&lt;/p&gt;

&lt;h2&gt;
  
  
  A review is a row
&lt;/h2&gt;

&lt;p&gt;The whole model is one class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;enum&lt;/span&gt; &lt;span class="kt"&gt;ReviewStatus&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;Codable&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;kept&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;trashed&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;/// The presence of a row means the photo is "reviewed".&lt;/span&gt;
&lt;span class="kd"&gt;@Model&lt;/span&gt;
&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="kt"&gt;PhotoReview&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;/// PHAsset.localIdentifier, unique per asset.&lt;/span&gt;
    &lt;span class="kd"&gt;@Attribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;assetIdentifier&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;statusRaw&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;reviewedAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Date&lt;/span&gt;

    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ReviewStatus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;get&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kt"&gt;ReviewStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;rawValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;statusRaw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;??&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kept&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;statusRaw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;newValue&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rawValue&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That gives three states for free:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No row:&lt;/strong&gt; never reviewed. "New only" decks show exactly these.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.kept&lt;/code&gt; row:&lt;/strong&gt; seen and kept, so it stays out of "New only" decks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.trashed&lt;/code&gt; row:&lt;/strong&gt; staged for deletion. Still in the library, still using space.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Restoring from Trash deletes the row, so the photo counts as unreviewed again; undo in the deck does the same. Swiping up to the Private Vault also writes a &lt;code&gt;.trashed&lt;/code&gt; row for the original, because the vault keeps its own copy. And an unreadable raw value reads as &lt;code&gt;.kept&lt;/code&gt;, the safe direction.&lt;/p&gt;

&lt;p&gt;The store is a thin wrapper over a &lt;code&gt;ModelContext&lt;/code&gt;. The Trash screen is just a query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="c1"&gt;/// All photos marked as trashed, most recently reviewed first.&lt;/span&gt;
&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;trashedReviews&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;PhotoReview&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;trashedRaw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;ReviewStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;trashed&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rawValue&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;descriptor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;FetchDescriptor&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;PhotoReview&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nv"&gt;predicate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;#Predicate&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;statusRaw&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;trashedRaw&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="nv"&gt;sortBy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;SortDescriptor&lt;/span&gt;&lt;span class="p"&gt;(\&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reviewedAt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;descriptor&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;mark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;identifier&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ReviewStatus&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;existing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;review&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;identifier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;existing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;
        &lt;span class="n"&gt;existing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reviewedAt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;PhotoReview&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;assetIdentifier&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;identifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The status is stored as its raw &lt;code&gt;String&lt;/code&gt; and pulled into a local constant before the &lt;code&gt;#Predicate&lt;/code&gt;, so the predicate is a plain string comparison against a captured value. &lt;code&gt;mark&lt;/code&gt; is an upsert: re-reviewing a kept photo flips its row to trashed instead of adding a second one, with &lt;code&gt;@Attribute(.unique)&lt;/code&gt; backing that up.&lt;/p&gt;

&lt;p&gt;A left swipe calls &lt;code&gt;mark(identifier:status:)&lt;/code&gt; with &lt;code&gt;.trashed&lt;/code&gt;. That's the whole cost of a swipe: no PhotoKit write, no prompt, and trivially undoable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Emptying Trash is one deleteAssets call
&lt;/h2&gt;

&lt;p&gt;Here is the function that actually removes assets from the library:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="c1"&gt;/// Permanently deletes the given assets. Triggers the system confirmation alert.&lt;/span&gt;
&lt;span class="kd"&gt;@discardableResult&lt;/span&gt;
&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;deleteAssets&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;identifiers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;fetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;PHAsset&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetchAssets&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;withLocalIdentifiers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;identifiers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// Nothing matched: the assets are already gone, so the requested end&lt;/span&gt;
    &lt;span class="c1"&gt;// state is achieved. Return true so Empty Trash can clear orphaned rows.&lt;/span&gt;
    &lt;span class="k"&gt;guard&lt;/span&gt; &lt;span class="n"&gt;fetch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;success&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;withCheckedContinuation&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;continuation&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
        &lt;span class="kt"&gt;PHPhotoLibrary&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;shared&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;performChanges&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;PHAssetChangeRequest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;deleteAssets&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nv"&gt;completionHandler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;success&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
            &lt;span class="n"&gt;continuation&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resume&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;returning&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;success&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;success&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;identifiers&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;assetCache&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;forKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;success&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Empty Trash passes every identifier on screen (respecting the Photos / Videos filter), so 3 items or 300 is one change block, one &lt;code&gt;deleteAssets&lt;/code&gt; call and one system alert. The Trash view awaits the &lt;code&gt;Bool&lt;/code&gt;. On &lt;code&gt;true&lt;/code&gt; it removes those review rows and the tiles disappear. On &lt;code&gt;false&lt;/code&gt; the rows and items stay. Declining the iOS alert ends up there, so "no" is a quiet no-op, not an error state.&lt;/p&gt;

&lt;p&gt;The swipe deck, the duplicate finder, Find Similar and Sort by Size never call this. Their "delete" is a &lt;code&gt;.trashed&lt;/code&gt; row. The other callers are explicit, one-off requests, such as Shrink Videos (Pro), which saves a smaller copy and then deletes the original behind the same system alert.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two safety nets I didn't have to build
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The iOS alert.&lt;/strong&gt; Swept can't skip it, and I wouldn't want to. Settings &amp;gt; Cleaning &amp;gt; "Confirm before delete" (on by default) adds Swept's own "Permanently delete N items?" alert in front of it, for people who want to see a count first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recently Deleted.&lt;/strong&gt; Assets deleted this way land in the Photos app's Recently Deleted album, which &lt;a href="https://support.apple.com/en-us/104967" rel="noopener noreferrer"&gt;Apple keeps for 30 days&lt;/a&gt;. A mistake after Empty Trash is still recoverable from Photos.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There's a catch with the second one. Apple's &lt;a href="https://support.apple.com/en-us/108922" rel="noopener noreferrer"&gt;iCloud storage article&lt;/a&gt; says that if you exceed your iCloud storage limit, your device immediately removes any photos and videos you delete and they won't be in Recently Deleted. So Recently Deleted isn't the main undo. The in-app Trash is, and the user decides when it empties.&lt;/p&gt;

&lt;h2&gt;
  
  
  Assets that vanish in the meantime
&lt;/h2&gt;

&lt;p&gt;Swept's Trash has no time limit, so weeks can pass between a swipe and Empty Trash. Meanwhile the user might delete the photo in Photos, or iCloud Photos might remove it after a delete on another device. A row pointing at nothing would show as a blank tile and inflate the count.&lt;/p&gt;

&lt;p&gt;So the Trash screen reconciles on every appearance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;refresh&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;trashed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trashedReviews&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(\&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;assetIdentifier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// One fetch yields existence AND creation dates: the dates seed the sort&lt;/span&gt;
    &lt;span class="c1"&gt;// so the grid renders already ordered (no post-load rearrange).&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;existing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;seededDates&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;existingAssets&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;trashed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// Clean up rows whose assets no longer exist.&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;stale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;trashed&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;existing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;stale&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isEmpty&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeReviews&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;identifiers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;stale&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;identifiers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;trashed&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;existing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;dates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;seededDates&lt;/span&gt;
    &lt;span class="nf"&gt;recomputeDisplayed&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;loadMetadata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;identifiers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;existingAssets(from:)&lt;/code&gt; is one &lt;code&gt;PHAsset.fetchAssets(withLocalIdentifiers:options:)&lt;/code&gt; call, enumerated once, collecting the identifiers that still exist and their &lt;code&gt;creationDate&lt;/code&gt;. Creation date is cheap, so the grid renders already sorted newest first. File sizes aren't, so they load afterwards on a detached task through a &lt;code&gt;nonisolated static&lt;/code&gt; function; only the Largest / Smallest sorts wait for them.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;guard fetch.count &amp;gt; 0 else { return true }&lt;/code&gt; in &lt;code&gt;deleteAssets&lt;/code&gt; covers the same problem at the last moment. If everything vanished between loading and the tap, "already gone" counts as success, so Empty Trash can't fail forever. If only some vanished, the fetch holds just the survivors, PhotoKit deletes those, and all the rows are cleared.&lt;/p&gt;

&lt;h2&gt;
  
  
  The "One last step" sheet
&lt;/h2&gt;

&lt;p&gt;The model is honest, but a left swipe still looks like a delete. Someone who swipes through 200 photos, backs out and checks Settings sees no change, and would fairly think the app did nothing. People who finish a deck get a session-complete screen with a "One last step" card and a "Review &amp;amp; empty Trash (N)" button. People who leave halfway never see it.&lt;/p&gt;

&lt;p&gt;So the back button checks three things: the deck isn't finished, this session staged something, and the user has never seen the reminder. If all hold, it presents a medium-detent sheet titled "One last step": the N items are waiting in the Trash and stay in the photo gallery, still taking up space, until it's emptied. One button goes straight to the Trash, the other exits.&lt;/p&gt;

&lt;p&gt;It's gated by an &lt;code&gt;@AppStorage&lt;/code&gt; flag, so it appears once per install. A comment in the code calls it "education, not a gate": after the first time, the results screen and the Trash count on Home repeat the lesson, and a sheet on every exit would only nag.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trade-offs I accepted
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Trash that never empties itself can grow large. The button shows the count and total size ("Empty Trash (N) · size") and there's a Largest first sort, so at least it's visible.&lt;/li&gt;
&lt;li&gt;Two steps (Empty Trash, then Recently Deleted) is more than people expect from a "cleaner". The sheet and card exist because of that; the alternative is an iOS alert per card.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to see it on a phone: &lt;a href="https://apps.apple.com/us/app/swept-photo-video-cleaner/id6786665535" rel="noopener noreferrer"&gt;Swept on the App Store&lt;/a&gt;. Questions about the PhotoKit side are welcome in the comments.&lt;/p&gt;

</description>
      <category>photos</category>
      <category>swift</category>
      <category>ios</category>
      <category>swiftui</category>
    </item>
    <item>
      <title>What I learned building a screenshot organizer that never sends a screenshot to a server</title>
      <dc:creator>Bazi</dc:creator>
      <pubDate>Tue, 27 Oct 2026 13:02:05 +0000</pubDate>
      <link>https://dev.to/bazibuilds/what-i-learned-building-a-screenshot-organizer-that-never-sends-a-screenshot-to-a-server-163</link>
      <guid>https://dev.to/bazibuilds/what-i-learned-building-a-screenshot-organizer-that-never-sends-a-screenshot-to-a-server-163</guid>
      <description>&lt;p&gt;I'm Bazi, and on the side I build &lt;a href="https://pizazoo.com" rel="noopener noreferrer"&gt;Pizazoo&lt;/a&gt;, an app that sorts screenshots into categories (Receipts, Chats, Code, Travel and so on) on iPhone, iPad and Mac. The one rule I set at the start: screenshots never leave the device. No account, no upload, no server-side model. Sync goes through the user's own iCloud.&lt;/p&gt;

&lt;p&gt;That rule shaped almost every technical decision. Here's what I learned, including the bugs that taught me the most.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pipeline, all on-device
&lt;/h2&gt;

&lt;p&gt;The Mac and iOS apps share one Swift processing pipeline. For each screenshot it collects several cheap signals and lets them vote:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Text&lt;/strong&gt;, from Apple's Vision text recognizer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image labels and a feature print&lt;/strong&gt; from Vision (a feature print is a compact vector you can compare between images).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic similarity&lt;/strong&gt; between the recognized text and each category's description, using NaturalLanguage sentence embeddings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keyword signals&lt;/strong&gt; for things with obvious tells (currency totals, stack traces, flight numbers).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A nearest-neighbour vote&lt;/strong&gt; from screenshots the user already placed or corrected, so it learns from fixes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple's on-device Foundation Models&lt;/strong&gt;, when the device supports them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this needs a network connection, and none of it costs me anything per user.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design for the device that can't run the model
&lt;/h2&gt;

&lt;p&gt;My own test iPhone reports &lt;code&gt;deviceNotEligible&lt;/code&gt; for Apple Intelligence, and so do plenty of real customers' phones. On those devices the Foundation Models path simply never runs.&lt;/p&gt;

&lt;p&gt;So the "fallback" is actually the main path. I stopped treating the language model as the classifier and started treating it as a bonus that can break ties when it's there. If your app leans on on-device AI, test seriously on a device without it, because a good share of your users have exactly that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Visual similarity is not classification
&lt;/h2&gt;

&lt;p&gt;This one produced my favourite bug: at one point every screenshot a user took landed in the same custom category.&lt;/p&gt;

&lt;p&gt;The cause was the visual nearest-neighbour vote. &lt;code&gt;VNFeaturePrintObservation&lt;/code&gt; distances are great for "find screenshots that look like this one" (that's what powers the Related screen), but screenshots all look alike to it: white backgrounds, text, status bars. They cluster tightly. Whichever category had the most example screenshots won the vote almost every time, and a lenient acceptance rule rubber-stamped it.&lt;/p&gt;

&lt;p&gt;The fix was a rule, not a threshold: a visual vote may only &lt;strong&gt;corroborate&lt;/strong&gt; a real text, label or keyword match. It can never decide on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Never let one slow framework block the queue
&lt;/h2&gt;

&lt;p&gt;macOS 27 brought a nasty surprise. Vision's text recognizer sometimes goes into a bad system-wide state: cold loads of 26 to 106 seconds, errors on images that read fine an hour later, and once a request that ignored cancellation for more than 29 minutes. Vision also holds a process-wide lock while loading, so image labels and feature prints stall behind it.&lt;/p&gt;

&lt;p&gt;Waiting for text inside the per-item timeout meant screenshots piled up unsorted. What fixed it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Give text recognition a fixed budget (20 seconds) in the first pass. If it isn't back, classify with the signals you have and keep going.&lt;/li&gt;
&lt;li&gt;Let the slow request finish in the background, and backfill the text later.&lt;/li&gt;
&lt;li&gt;Warm the recognizer up with an image that actually contains text. A blank warm-up image only loads the detector, so the first real request still paid the full cost.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Let the recognizer detect the language
&lt;/h2&gt;

&lt;p&gt;At one point I replaced automatic language detection with an explicit list (the user's preferred languages plus English), hoping it would avoid the macOS 27 stall. It didn't help with the stall: a controlled run with an explicit &lt;code&gt;["en-US"]&lt;/code&gt; stalled for 62 seconds anyway. It did cause a real regression, though: for a user with an English system language, screenshots of Chinese or Arabic text were no longer recognized at all. They weren't searchable, and the auto-redact feature couldn't see personal info in them.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;automaticallyDetectsLanguage = true&lt;/code&gt; is back, with a comment in the code saying not to narrow it again without measuring both effects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sync without a server of your own
&lt;/h2&gt;

&lt;p&gt;Pizazoo syncs through CloudKit with its own sync engine and custom records, not SwiftData's built-in mirroring. Three lessons from that:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pin SwiftData away from CloudKit.&lt;/strong&gt; Once the app has the iCloud entitlement, &lt;code&gt;ModelConfiguration&lt;/code&gt; defaults to mirroring the store through CloudKit, which requires every attribute to be optional and forbids unique constraints. Our schema has neither, so the store failed to load at launch (&lt;code&gt;NSCocoaErrorDomain 134060&lt;/code&gt;). The fix is one argument, &lt;code&gt;cloudKitDatabase: .none&lt;/code&gt;, and it now has a comment that nobody should remove it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Make conflict resolution deterministic.&lt;/strong&gt; Reinstalling the iOS app used to duplicate every screenshot in iCloud: the reinstall re-imported photos under new IDs while the old records synced back. Now rows with the same SHA-256 of the image bytes are merged, and the survivor is the row with the smallest UUID string. Every device picks the same survivor without talking to the others. The rule I wrote next to it: never make this order-dependent, or two devices can each delete the other's copy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Change the hash when you change the pixels.&lt;/strong&gt; The sync engine re-uploads an image only when its checksum changes. Editing a screenshot in place (markup, blur) and forgetting to recompute the checksum means the edit quietly stays on one device. Every code path that overwrites pixels now has to update the checksum.&lt;/p&gt;

&lt;h2&gt;
  
  
  The OS will change underneath you
&lt;/h2&gt;

&lt;p&gt;On macOS 27, &lt;code&gt;defaults write com.apple.screencapture location ...&lt;/code&gt; runs without any error and does nothing. Screenshots keep landing on the Desktop, because the active setting moved to a new key, &lt;code&gt;location-screenshot&lt;/code&gt;. The app read the old key, so its settings screen showed the wrong folder. It now reads the key for the running OS version and writes both. I also wrote it up for other people, because a silent no-op like that wastes a lot of afternoons.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell myself at the start
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Keep everything on-device if you can. It removes a whole category of cost and liability, and users notice.&lt;/li&gt;
&lt;li&gt;Treat on-device AI as an upgrade, not a dependency.&lt;/li&gt;
&lt;li&gt;Be suspicious of any single signal that "almost always" wins.&lt;/li&gt;
&lt;li&gt;Put a budget on every system framework call that can stall.&lt;/li&gt;
&lt;li&gt;Leave comments that explain why a line must not change. Future you will try to change it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're curious, Pizazoo is at &lt;a href="https://pizazoo.com" rel="noopener noreferrer"&gt;pizazoo.com&lt;/a&gt;. It's free to organize, search and mark up, with a one-time Pro upgrade. I'm happy to go deeper on any of this in the comments.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: I'm the developer of Pizazoo. This post was drafted by an AI agent working from my own code and engineering notes.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>swift</category>
      <category>ios</category>
      <category>macos</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
