| 1 | # Oficina Sheets for Mac, iPhone and iPad |
| 2 | |
| 3 | Entirely native SwiftUI editors use the same authenticated Go calculation, |
| 4 | formatting, sealed storage and permission paths as the web application. |
| 5 | No embedded browser editor or second formula engine is used. |
| 6 | |
| 7 | Build with Xcode 26.6, Swift 6.2+, and XcodeGen: |
| 8 | |
| 9 | ```sh |
| 10 | native/scripts/build-mac.sh |
| 11 | native/scripts/build-iphone.sh simulator |
| 12 | ``` |
| 13 | |
| 14 | The macOS bundle is `native/build/Oficina Sheets.app`. Simulator products |
| 15 | are under `native/build/ios`. Device builds use `build-iphone.sh device` |
| 16 | and require `OFICINA_DEVELOPMENT_TEAM` and the team's normal signing setup. |
| 17 | Simulator and device builds use separate DerivedData directories. |
| 18 | `OFICINA_SKIP_PROJECT_GENERATION=1` allows the suite runner to generate the |
| 19 | project once before starting parallel builds. |
| 20 | |
| 21 | The shared native transport and Mac packaging tools are pinned to revision |
| 22 | `1e36aac95ed252848722926efc8ba8f9dc803216` of |
| 23 | `https://amadan.net/rastrillo/native`, on its main branch (the merge of `native/oficina-id-straight-in`: Oficina ID |
| 24 | straight in, Paul's ruling of 2026-11-19). The pin is written in |
| 25 | `apple/Package.swift`, `apple/Package.resolved`, `macos/project.yml`, |
| 26 | `macos/SheetsMacStore.xcodeproj/project.pbxproj`, `ios/project.yml` and here. |
| 27 | Both SwiftPM and Xcode resolve that revision; no sibling development checkout |
| 28 | is required. |
| 29 | |
| 30 | Sign-in is Oficina ID first (Home `docs/superpowers/specs/2026-11-14-oficina-id-native.md`, |
| 31 | slice A, with Paul's straight-in ruling of 2026-11-19), through rastrillo/native's |
| 32 | `RastrilloApple/OficinaID` kit: one Oficina ID on the device opens its team with no |
| 33 | screen; several ask which; "Use another Oficina ID" is in the account menu. "Other ways |
| 34 | to sign in…" keeps the server address and browser approval for self-hosted servers and |
| 35 | local accounts; someone already signed in that way keeps those accounts, and nothing goes |
| 36 | straight in while that is the route. The server half is `POST /native/oficina-id` |
| 37 | (`internal/sheets/home_routes.go`). |
| 38 | |
| 39 | The kit needs these grants on every build: `macos/DeveloperID.entitlements` (Sparkle, |
| 40 | named by `mac-updates.json`), `macos/AppStore.entitlements`, and `ios/SheetsPhone.entitlements`. |
| 41 | Each has `keychain-access-groups` = `9U4A84C4WK.works.oficina.sheets` **first**, then |
| 42 | `9U4A84C4WK.works.oficina.id`, the App Group (`9U4A84C4WK.works.oficina` on Mac, |
| 43 | `group.works.oficina` on iOS) and `webcredentials:id.oficina.works`. A Developer ID build |
| 44 | claiming them without its embedded profile is killed at launch; `mac-updates.json` names |
| 45 | the profile by local path (never committed). A signed build, then the launch gate (spec |
| 46 | §13), which must pass on the final notarised artifact before any Sparkle publish: |
| 47 | |
| 48 | ```sh |
| 49 | native/scripts/build-mac.sh --updates-config mac-updates.json \ |
| 50 | --sign-identity 'Developer ID Application: Team Tito Limited (9U4A84C4WK)' |
| 51 | "native/build/Oficina Sheets.app/Contents/MacOS/SheetsMac" --oficina-id-launch-check |
| 52 | ``` |
| 53 | |
| 54 | An ad hoc or simulator build drops the grants; Oficina ID then cannot read the keychain. |
| 55 | `SignedInLaunchTests` hosts the home window with an Oficina ID already saved and checks it |
| 56 | settles (Docs 0.1.7/0.1.8 hung at launch only for people signed in). |
| 57 | |
| 58 | The Sparkle build updates quietly, as Calls does: `"install": "automatic"` in |
| 59 | `mac-updates.json` writes Sparkle's automatic check, download and install keys |
| 60 | (no first-launch question), and `NativeUpdater(policy: .quiet)` keeps scheduled |
| 61 | checks from opening a window. A downloaded update installs on quit; the app menu |
| 62 | offers "Update Ready — Restart Sheets" and the Home window shows a one-line notice. |
| 63 | |
| 64 | Select a cell, then edit its formula bar, double-click, press Return or F2 |
| 65 | (these keep the cell's contents), or just type (this replaces them, as in |
| 66 | Numbers or Excel). The keystroke that starts typing goes to the cell's own |
| 67 | text field, so a dead key (´ then e) or an input method composes from the |
| 68 | first key. On iPad and iPhone a hardware keyboard works the same way: while |
| 69 | a cell is selected an invisible text field sits on it holding the keyboard |
| 70 | (without raising the on-screen one), so arrows, Return, Tab and Delete move |
| 71 | and clear, and the first typed or composed text starts the edit in place. |
| 72 | Touch editing stays in the formula bar (double-tap a cell). Enter saves and moves down; Tab saves and moves right; Escape |
| 73 | discards the focused cell edit. The range field accepts |
| 74 | addresses such as `A1:C10`. Menus provide copy/paste, clear, fill, formatting, |
| 75 | size controls, functions, history, comments, sharing and workbook transfer. |
| 76 | Sort/filter opens a native table preserving each cell's original reference. |
| 77 | |
| 78 | Network content uses ephemeral transport. Requested exports stream to a private |
| 79 | temporary workbook and are handed to the system file-save picker; the temporary |
| 80 | file is removed on completion, cancellation or failure. Value edits are |
| 81 | optimistic: a committed cell shows its value at once and the send happens in |
| 82 | the background, one at a time per document, with edits made meanwhile sent |
| 83 | together next. A refused or unanswered edit keeps its value on screen with a |
| 84 | small red corner mark and offers Retry and Revert (on the cell's context menu |
| 85 | and above the grid); editing carries on around it. Window close and Quit wait |
| 86 | for edits on their way and ask about failed ones. Edits live in memory until |
| 87 | the server has them: they do not survive a crash or quit while offline. The app does not claim offline editing or sealed local document caches. |
| 88 | |
| 89 | Current web limits remain visible: a single worksheet, a 500-row/200-column |
| 90 | grid window, 500-cell paste limit, first-worksheet XLSX/XLSM import up to |
| 91 | 20 MiB, and no undo for formatting or sizing. Formula evaluation and number |
| 92 | display come from the Go server. Charts, conditional-format rule editing, |
| 93 | structural row/column changes and additional worksheet editing do not exist |
| 94 | in the web baseline and are not represented as finished features here. |
| 95 | |
| 96 | Verification: |
| 97 | |
| 98 | ```sh |
| 99 | swift test --package-path native/apple |
| 100 | go test ./... |
| 101 | ``` |
| 102 | |
| 103 | `SheetsReview` and `SheetsReviewPhone` are separate, unshipped review targets. |
| 104 | Their fixture server uses temporary databases and ordinary authenticated |
| 105 | sessions. Production entry points never contain fixture credentials. |
| 106 | See the native design spec and review records for exercised coverage; |
| 107 | compiling a target alone does not establish editing parity. |
| 108 | |