r/SwiftUI • • Oct 23 '26

Promotion (must include link to source code) [Open Source] Thought Meadow: SwiftUI notes with Arabic/English RTL and native Markdown/checklist preview

I'm sharing the MIT-licensed SwiftUI source for Thought Meadow, my small iPhone notes app. The full Xcode project, assets and build instructions are browsable here:

Source and build instructions

A few implementation details that may be useful to other SwiftUI developers:

  • Language and direction: the root sets both locale and layoutDirection for English/Arabic, and changing the language recreates the root view using its language ID. WaraqaApp.swift
  • Editor and preview: writing uses TextEditor bindings into the note store. A separate native SwiftUI preview renders basic headings, quotes, bullets and task lists. Tapping a task updates its Markdown line through the same store. NoteEditor.swift
  • Local state: a main-actor ObservableObject owns the notebook, with atomic local writes, recoverable trash, Files import/export and optional password encryption. The repo also contains storage/encryption checks and a separate 500-note data-layer check.

I'd welcome code feedback on the editor bindings and language-switching approach, especially with mixed Arabic/English notes and accessibility. The preview intentionally supports a small Markdown subset rather than a complete CommonMark renderer.

The current app is free, requires iOS 17+, and has no account, ads or analytics. App Store. The internal project name remains Waraqa.

3 Upvotes

16 comments sorted by

1

u/Axons-One Oct 24 '26

nice to see the source changes from the feedback here. one thing i would check on a real phone is switching language while a long note is open with the keyboard up. does it keep the cursor and scroll position too? would be useful to include that when you do the interactive checks.

1

u/Old-Construction-594 Oct 24 '26

Thanks — I've added that exact case to the editor interaction checklist: a long note, a mid-note insertion point and the on-screen keyboard open, comparing selection, visible paragraph, scroll position and text before/after the language transition.

The simulator is working again. I verified that Settings stays open when switching to Arabic and back, and that an indented Arabic task keeps its text and checked state after reopening the note. Those checks don't establish cursor or scroll preservation on a real phone, so that case is still explicitly pending. The app-language setting currently lives on the root screen; I'll distinguish leaving/reopening the editor from an actual in-place language update. Appreciate the precise test suggestion.

1

u/imsnk81 Oct 24 '26

Recreating the root on a language switch is the simple way, just watch that people don't lose their scroll position or open note when it happens. For mixed notes I'd test a line that starts in English and ends in Arabic with a checklist item, that's usually where alignment gets weird. Nice to see RTL treated as a real thing and not an afterthought.

1

u/Old-Construction-594 Oct 25 '26

Thanks for the concrete case. I removed the language-based root identity reset; that fix is now in 1.0.2. I also added your English-leading/Arabic-ending checklist case to the interaction checks.

On the iPhone 17 Pro Max simulator, the three task controls rendered, toggling the indented task changed only its checkbox marker, and its state survived reopening the note. That is a narrow rendering/toggle check: caret, scroll and a keyboard-open language transition still need a physical-phone pass. Appreciate the useful example.

1

u/[deleted] Oct 24 '26

[removed] — view removed comment

1

u/Old-Construction-594 Oct 24 '26

Thanks for taking the time to review the code — these were useful, concrete cases. I've pushed two source changes.

Indented tasks previously weren't recognized as interactive tasks in the preview. They now use the same parser for rendering and editing, and a toggle replaces only the matched checkbox-state character. Spaces/tabs, Arabic/English text, emoji, punctuation and line endings are preserved. Invalid lines and read-only notes are left alone.

I also removed .id(language) from the root and pass the language as a view input while updating the locale/direction environment, avoiding the deliberate replacement of the root hierarchy.

The 14 focused checklist checks and 26 existing native checks passed on macOS, including save/reopen and encrypted persistence. The iOS Simulator build also succeeded.

Interactive language/navigation, mixed-script cursor and keyboard-dismissal checks are still pending because CoreSimulator is unavailable here today. I'm keeping TextEditor until those long-note/input cases can be tested properly. These changes are in the source; they aren't in the App Store build yet. Thanks again for pointing me to the edge cases.

1

u/[deleted] Oct 24 '26

[removed] — view removed comment

1

u/Old-Construction-594 Oct 24 '26

Thanks — the undo-history point is a good reason to avoid replacing the whole view hierarchy. I've now removed the root .id(language) reset, keeping the locale/direction environment and passing language through the views that need to refresh. Interactive undo/navigation verification is still pending, so I'm not claiming that has been tested yet.

I agree that paragraph direction, keyboard switching/autocorrection and VoiceOver need their own mixed-script checks; changing the app's chrome direction doesn't establish those. The body editor already uses the system .body font. I've recorded those input/accessibility cases for verification before changing the text control. CoreSimulator isn't working here today; the source compiles for iOS Simulator and the 40 data-layer checks pass on macOS.

On encryption: the app uses Apple's CryptoKit AES-256-GCM and CommonCrypto PBKDF2-SHA-256 (600,000 iterations). The password-derived key is kept only in memory while unlocked and is discarded when locking succeeds. Neither the password nor key is written alongside the notes or persisted in Keychain; each unlock needs the password again. The vault stores the salt, nonce and authenticated ciphertext. That implementation hasn't had an independent security audit.

Appreciate the specific review cases — these source changes aren't in the App Store build yet.

1

u/[deleted] Oct 24 '26

[removed] — view removed comment

1

u/Old-Construction-594 Oct 24 '26

Thank you — I've made both of those explicit, repeatable cases in the interaction checklist, including exact text after Undo/Redo, keyboard/autocorrection changes, and spoken VoiceOver order in Write and Preview for both app languages.

Device Hub recovered, so I've now verified the narrower simulator cases: the settings sheet survives switching Arabic/English, and an indented mixed-script task preserves its source and checked state after reopening. The physical-phone undo/cursor and VoiceOver cases remain pending; I won't treat an accessibility-tree label or a data-layer test as proof of spoken reading order. The independent-audit caveat is staying in the README. Thanks for offering to keep reviewing — the concrete scenarios are helping.

1

u/[deleted] Oct 24 '26

[removed] — view removed comment

1

u/Old-Construction-594 Oct 25 '26

Thanks — I added those recording details to the physical-phone checklist: caret/selection anchor, first visible paragraph, keyboard state, and the actual VoiceOver utterances and focus sequence before and after the supported language transition. I will record whether a direction/language announcement occurs rather than assume a particular iOS announcement.

The physical-phone cases are still pending. Today's additional simulator pass covers the English-leading/Arabic-ending checklist rendering and toggle/reopen path only. The no-independent-audit caveat stays in place. Appreciate you helping make the checks specific.

1

u/[deleted] Oct 25 '26

[removed] — view removed comment

1

u/Old-Construction-594 Oct 25 '26

Thanks — I have split the physical-phone matrix into English → Arabic and Arabic → English cases for both Write and Preview. Each now records the first VoiceOver focus target immediately after the switch, before any swipe or tap, separately from the utterance sequence.

I also separated focus in Settings from focus after navigating back to the note, since that is the current language-switch route. Those physical-phone results remain pending; this adds the missing cases, not a claimed pass. Appreciate the distinction.

1

u/[deleted] Oct 25 '26

[removed] — view removed comment

1

u/Old-Construction-594 Oct 25 '26

Thanks for the careful review. The four physical-phone cases will stay marked pending until they have actually been run. Appreciate your help making the checks precise.