expect-actual-composable-capability

Installation
SKILL.md

Platform capabilities as composable expect functions

Three shapes cover almost everything, and they are worth telling apart because each fails differently:

@Composable expect fun getScreenSizeInfo(): ScreenSizeInfo   // a measurement
@Composable expect fun KeepScreenOn()                        // an effect with an undo
@Composable expect fun rememberIsInPipMode(): Boolean        // a subscription, read as state

Every declared type is a common type: the measurement returns a small data class declared in the shared module, not a platform window object. That is the whole point — callers in shared code stay free of platform types, and the platform detail lives in exactly one file per target.

A capability one platform lacks still gets a full actual. It returns the neutral value:

Installs
2
GitHub Stars
35
First Seen
6 days ago
expect-actual-composable-capability — maxrave-dev/kotlin-footguns