# /v1/index.txt # platform: 1 # updated: 2026-09-07 Micro-app platform, version 1. A micro app is a single JavaScript file that runs inside a native iOS host app; the host renders the app's view tree as real SwiftUI controls and gives it a small set of native capabilities. The file declares a manifest, an init() function that returns the initial state, an update() function that returns the next state for an action, and a view() function that turns state into a tree of nodes built with h(). There is no DOM, no network, no module system and no build step: the only APIs are h(), the nodes listed in components.txt, the tokens in styling.txt, the native namespaces in native.txt, console.*, and the timer functions. These documents are the complete contract; anything not described here does not exist on the platform. == Contract == const manifest = { platform: 1, // required, must be 1 name: "Tally", // required, shown in the library icon: "number", // required, SF Symbol name (see icons.txt) category: "Utilities", // Utilities | Productivity | Health | Finance | Fun | Learning | Other capabilities: ["store"], // native namespaces the app uses; [] if none }; function init() { return { count: 0 }; } // initial state, JSON-serializable function update(state, action, payload) { return state; } // pure, synchronous, returns a NEW state function view(state) { return h("Text", { text: "Hi" }); } // pure, returns exactly one root node function onLoad(state) { return state; } // optional, runs once after init(), for native.store Rules that always apply: - Exactly one JavaScript file, ES2022 syntax, no imports, no exports, no JSX, no require(), no fetch(), no document, no window. - h(type, props, children) builds nodes. type is a node type from components.txt. children is an array, a single node, or omitted. Text is never implicit: use h("Text", { text: "..." }). - update() never mutates state; it returns a new object ({ ...state, x: y }). - Every native. the code touches must be listed in manifest.capabilities. - native is not available at the top level of the file or inside init(); read the store in onLoad(state). - Async natives (camera, photos, files.import, clipboard.read) take { then, fail } action names and dispatch their result later; update() stays synchronous. - Every child of a ForEach carries a unique id prop. - Every icon prop is an SF Symbol name; prefer names from icons.txt. == Output format == When an AI is asked to produce a micro app, the deliverable is the file contents and nothing else: no explanation before or after the code, no markdown fences, no "here is your app". The first non-blank line of the answer is "const manifest = {" and the last line closes the view() function or the last helper. For a revision, deliver the complete revised file, not a diff. == Files == quickstart.txt One annotated counter app, then persistence, a list and a second tab added in three steps. Enough for simple apps. state.txt State model: immutability, action and payload conventions, async natives, timers, onLoad and persistence, the ForEach onDelete contract, common mistakes. components.txt Every node type with props, defaults, allowed values, children rules and examples. Read for any UI work. styling.txt Color, font, weight and spacing tokens; padding and frame forms; modifier order; dark mode; what is deliberately unavailable. native.txt The native namespaces (store, haptics, clipboard, share, camera, photos, files, date): signatures, payload shapes, limits. icons.txt Curated SF Symbol names grouped by purpose. checklist.txt Self-review list to run before delivering the file. changelog.txt Dated additive changes within platform 1 and the minimum host build that supports each. examples/ Complete validated apps: 01-counter.js, 02-list-persistence.js, 03-tabs-navigation.js, 04-camera-assets.js, 05-countdown-timer.js, 06-picker-computed.js full.txt All of the above in one file. Which to read for which task: - Any app: quickstart.txt, then checklist.txt before delivering. - Any UI work: components.txt and styling.txt. - Lists, forms, tabs, sheets, alerts: components.txt (combined examples) and examples/02-list-persistence.js, examples/03-tabs-navigation.js. - Persistence, timers, async results: state.txt. - Camera, photos, files, clipboard, share, haptics, dates: native.txt. - Choosing an icon: icons.txt. == Checklist == Run checklist.txt as the last step before delivering. Every item is checked by the host's validator when the user pastes the file, so a miss costs a round trip. == Changelog == Platform 1 changes are additive and dated in changelog.txt together with the minimum host build that supports them. Docs for platform 1 stay at /v1/ forever; a breaking change would publish /v2/ and leave /v1/ online. See also: https://aistudio.l13s.cc/v1/index.txt https://aistudio.l13s.cc/v1/quickstart.txt https://aistudio.l13s.cc/v1/state.txt https://aistudio.l13s.cc/v1/components.txt https://aistudio.l13s.cc/v1/styling.txt https://aistudio.l13s.cc/v1/native.txt https://aistudio.l13s.cc/v1/icons.txt https://aistudio.l13s.cc/v1/checklist.txt https://aistudio.l13s.cc/v1/changelog.txt https://aistudio.l13s.cc/v1/full.txt