Files
__mahjong/AGENTS.md
T
kornerr cf79e89dc4 Create hello-platform for iOS (#11)
Co-authored-by: Михаил Капелько <kornerr@gmail.com>
2026-11-01 07:19:54 +01:00

2.8 KiB

OGS applications (mj)

Native SwiftUI apps on the Dialect v4 declarative reactive engine (v2.0.0). Remote: https://git.opengamestudio.org/mahjong/mahjong.

Apps

  • hello/hello-platform/ — macOS + iOS platform-support sample (Hello counter). Its structure, startup flow and dialect rules are in docs/hello-platform.md; read that file whenever anything from hello-platform is referenced.

Layout

  • <app>/dialect.yml → generates <app>/ver-mac/src/dialect.swift.
  • components/ — shared source of truth; app src/ entries are relative symlinks: edit the real files and keep symlink parity.
  • hello-platform uses components/hp/ for its component, view model and shared SwiftUI view, and components/other/ for shared helpers.
  • history/gitjs/ — historical JS reference, outside the build.

Build

Prereqs: sibling ../dialect checkout (util/build-generator).

cd hello/hello-platform
util/build-mac
util/run-mac
util/prepare-ios    # xcodegen; xcodebuild command is in docs/hello-platform.md

build-mac regenerates Dialect, runs swift build in ver-mac/, then packages the binary and ver-mac/res/ into ver-mac/.build/<App Name>.app. ver-ios/ mirrors ver-mac/ and shares dialect.swift, HPView and the app icon via symlinks. Dangling-symlink audit: find components hello -type l ! -exec test -e {} \; -not -path '*/.build/*'

iOS simulator: use IVA (EB867790-F2C0-4392-9F99-C509D4487FDA, iPhone 17, iOS 26.5), not iPhone 15 Pro.

Dialect

  • Edit <app>/dialect.yml / components/, then util/build-mac; manual edits to the generated dialect.swift are overwritten.
  • struct F (field names) exists only in dialect.swift: a new field needs static let <field> = "<field>" hand-patched in ASCII order or F.<field> will not build.
  • Validate: ruby -ryaml -e 'YAML.load_file("hello/hello-platform/dialect.yml")'. Every should-label (1. Upon each ...) MUST end with a colon — ../dialect/components/yml/ymlFun.swift blindly dropLast()s it. Complaints inside if:/then: (unquoted : ) are expected.

Conventions

  • Mirror Swift/iOS into Android (naming, text, layout, styling).
  • Compose: named MaterialTheme.typography styles over fontSize.
  • Kotlin: wildcard imports for multiple declarations from one package, including generated ones; subpackages need separate imports.
  • .build/, build/, .DS_Store, Xcode/Gradle artifacts are git-ignored.

Source studies

Follow docs/file-summary.md (single-file) and docs/mirror-summary.md (mirrored platforms: one self-contained HTML with aligned function starts, original line numbers, green/orange fills, counts, non-repetitive explanations); never substitute working-tree code for a requested historical revision.