Pantrix UI

Platforms

Each platform's entry point draws the same App(), and the theme fits it to the platform by itself. What differs from one platform to another, and what a project adds for each.

One app, four entry points

Android

MainActivity.kt

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        enableEdgeToEdge()
        super.onCreate(savedInstanceState)
        setContent { App() }
    }
}

iOS

MainViewController.kt

fun MainViewController(): UIViewController = ComposeUIViewController { App() }

Desktop

Main.kt

fun main() = application {
    Window(onCloseRequest = ::exitApplication, title = "My app") {
        App()
    }
}

Web

Main.kt

@OptIn(ExperimentalComposeUiApi::class)
fun main() {
    ComposeViewport(viewportContainerId = "app") {
        PantrixTypefaceGate(onShown = { document.getElementById("loading")?.remove() }) {
            App()
        }
    }
}

What the theme fits

By platform
AndroidiOSDesktopWeb
Touch target48dp44pt32dp under a pointer32dp, 48dp to a finger
Focus ringFor the keyboardFor the keyboardFor the keyboardFor the keyboard
Component stylesAndroid'siOS'sThe desktop'sThe web's
HapticsPlayedPlayedNoneNone
Pointer shapesWith a mouseNoneYesYes

PantrixTheme.platform says which conventions hold: its type, whether it is used by touch, its smallest touch target. A browser on a phone is the web used by touch, and the theme knows it by itself.

On each platform

Android
API 30 and newer. enableEdgeToEdge() lets the app draw behind the system bars, and PantrixScaffold keeps its content clear of them. The outermost theme makes tags the resource ids Maestro and UI Automator find.
iOS
Devices, and the simulator on Apple silicon. The library is built against the iOS 27.1 SDK and brings the fold's bridge: no cinterop of the project's own. The status bar, the keyboard and the controls follow the theme: System bars.
Desktop
The JVM. The window's title follows the screen with PantrixWindowTitle; a shortcut for the whole window is written once for every system: Keyboard shortcuts.
Web
Wasm and JS. PantrixTypefaceGate draws the app once its typeface has come, so the type never changes before the reader's eyes: Web fonts.

Where next