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; appsrc/entries are relative symlinks: edit the real files and keep symlink parity.hello-platformusescomponents/hp/for its component, view model and shared SwiftUI view, andcomponents/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/, thenutil/build-mac; manual edits to the generateddialect.swiftare overwritten. struct F(field names) exists only indialect.swift: a new field needsstatic let <field> = "<field>"hand-patched in ASCII order orF.<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.swiftblindlydropLast()s it. Complaints insideif:/then:(unquoted:) are expected.
Conventions
- Mirror Swift/iOS into Android (naming, text, layout, styling).
- Compose: named
MaterialTheme.typographystyles overfontSize. - 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.