AI Study Notes is an iPad study notebook for handwritten learning. The goal is to combine a GoodNotes-style writing surface with an AI assistant that can understand the full page while focusing on the selected region.
The main loop is:
Write with Apple Pencil -> select a region -> ask the AI sidebar -> keep writing and organizing notes
- SwiftUI app structure
- iPad-only project configuration
- PencilKit canvas wrapped in SwiftUI
- Custom writing toolbar instead of the default PencilKit floating tool picker
- Pen, highlighter, eraser, lasso, color, width, and preset controls
- Page model with templates, page size, optional background image, and PencilKit drawing data
- Local notebook persistence
- Page thumbnail sidebar
- Page creation, selection, duplication, deletion, reordering, and batch actions
- PDF import using PDFKit and
UIDocumentPickerViewController - AI selection workflow with full-page and selected-area context
- Resizable right sidebar for notebook-level chat
- Markdown-friendly AI response display and copy actions
The backend lives in worker/ and is designed as a Cloudflare Worker proxy. It receives notebook context and forwards multimodal requests to an AI provider. Secrets must be configured through the deployment platform and must not be committed.
Expected endpoints:
GET /health
POST /ai/chatRequired secret:
npx wrangler secret put DASHSCOPE_API_KEYOptional non-secret model variables:
QWEN_FLASH_MODELQWEN_PLUS_MODEL
brew install xcodegen
xcodegen generate
open AIStudyNotes.xcodeprojRun the AIStudyNotes scheme on an iPad simulator or a connected iPad.
The app reads AIBackendURL from Info.plist, generated by XcodeGen from project.yml.
For public development, keep this value empty or use a placeholder. For private deployment, set it to your own Worker base URL and regenerate the project:
AIBackendURL: "https://your-worker.example.com"xcodegen generateIf AIBackendURL is empty, the app uses MockAIClient for local UI testing.
project.yml: XcodeGen configuration and app Info.plist valuesAIStudyNotes/AIStudyNotesApp.swift: app entry pointAIStudyNotes/Models/Notebook.swift: notebook modelAIStudyNotes/Models/NotePage.swift: page model, template, size, background, and drawing dataAIStudyNotes/Models/NotebookChatMessage.swift: AI chat and selection modelsAIStudyNotes/Models/CanvasTool.swift: writing tool definitions and presetsAIStudyNotes/Stores/NotebookStore.swift: main app state and notebook operationsAIStudyNotes/Views/NotebookView.swift: notebook shell and page sidebarAIStudyNotes/Views/NotePageView.swift: page canvas, toolbar, selection, and AI sidebarAIStudyNotes/Views/PencilCanvasView.swift: PencilKit bridgeAIStudyNotes/Services/AIClient.swift: mock and remote AI clientsAIStudyNotes/Services/NotebookPersistence.swift: local persistenceAIStudyNotes/Services/PageRenderer.swift: page and selection renderingworker/src/index.ts: Cloudflare Worker backend
- Keep the visible writing tools custom and compact.
- Do not replace the main writing UI with the default
PKToolPicker. - Keep the AI assistant in a resizable sidebar rather than in floating cards over the page.
- Preserve the meaning of selection: the AI receives the full page and treats the selected region as the focus.
- Keep notebook chat history scoped to the notebook.
- Do not commit production API keys, tokens, private service URLs, or signing credentials.
- Improve notebook library management for multiple notebooks.
- Add export flows for PDF or images.
- Add OCR search and handwriting-to-text experiments.
- Improve lasso actions for moving, scaling, and copying handwritten content.
- Add shape recognition and object tools such as images, stickers, and text boxes.
- Add optional audio recording linked to page timelines.
- Design a migration strategy for persisted notebooks as the model evolves.
xcodegen generatesucceeds.- The
AIStudyNotesscheme builds for an iPad simulator. - Writing remains smooth after page resize and sidebar resize.
- PDF import creates correctly sized pages with rendered backgrounds.
- Page thumbnails update after drawing and page operations.
- AI selection captures both full-page and selected-area context.
- Empty backend configuration falls back to
MockAIClient. - Public repository scans do not show committed secrets or private endpoints.