API Overview
PulsePlatform publishes one package per role. The rules live in jp.kaleidot725.pulse.architecture (the architecture artifact). The library lives in jp.kaleidot725.pulse.mvi, published as mvi-desktop for the desktop and mvi-mobile for Android and iOS. Navigation 3 support lives in jp.kaleidot725.pulse.navigation, published as navigation-desktop and navigation-mobile.
Rules
The assertions your tests call, and the queries behind them. Every page of the Rules API applies to desktop and mobile code alike, except where a check says which.
| Assertion | Description |
|---|---|
assertPulseMviConventions | The next twelve checks, in order |
assertStatesAreDataTypes | A PulseState is a data class or data object |
assertMessagesAreSealedOrDataTypes | A message is a sealed class with data class / data object cases, or a single data class / data object |
assertStatesAndMessagesLiveInContracts | States and messages are in a …Contracts.kt beside their ViewModel or Container |
assertViewModelsAndContainersAreNamedAfterTheirBase | …ViewModel and …Container |
assertViewModelsHoldTheirDataInTheirState | No var property on a ViewModel or Container |
assertViewModelsLiveInContents | A ViewModel lives under content |
assertContainersLiveAtTheFeatureRoot | A Container lives at the feature root |
assertHostsComposeContents | A host is named …Host and composes contents instead of binding a ViewModel |
assertFeaturePackagesHaveARole | A file in a feature is at its root or under content, section or component |
assertContentsBindAViewModel | A content binds its ViewModel with PulseContent |
assertSectionsAndComponentsArePure | Sections and components take data and callbacks only |
assertSectionsAndComponentsHavePreviews | Every section and component has a <Name>_Preview |
assertPulseMobileConventions | The checks for an app on mvi-mobile, in order |
assertMobileFeaturesHaveOneViewModel | A mobile ViewModel is at its feature root and alone there |
assertScreensBindTheirViewModel | A mobile feature's root composable is a …Screen that binds its ViewModel |
assertMobileFeaturePackagesHaveARole | A file in a mobile feature is at its root or under section or component |
assertPulseDomainConventions | A repository exposes flows and returns Result<V, E> from one-shot calls; a use case lives in usecase and is more than one line |
assertPulseModuleConventions | Modules depend on each other the way Clean Architecture asks, and the domain, data and design system are split into packages |
assertPulseKoinConventions | Koin modules are declared in the app module |
assertPulseResourceConventions | The domain holds no text, and composables read their text from string resources |
PulseModuleLayout | Which module names play which layer |
Library
PulseViewModel, PulseContent and the three markers below are in both mvi-desktop and mvi-mobile. On mobile, PulseViewModel takes three type parameters instead of five.
| Declaration | Description |
|---|---|
PulseViewModel | Abstract base class that holds one UI state, handles actions and emits events |
PulseContent | Observes a ViewModel; provides the state and an action dispatcher |
PulseState | Marks a class as a ViewModel's UI state |
PulseAction | Marks a class as a user action |
PulseEvent | Marks a class as a one-time side effect |
Desktop
These are in mvi-desktop only.
| Declaration | Description |
|---|---|
PulseContainer | Coordinates the ViewModels of a window |
PulseHost | Scopes a Container to a subtree; enables refresh and broadcast callbacks |
PulseBroadcast | Marks a class as a Container broadcast message |
PulseUnicast | Marks a class as a child-to-parent unicast message |
Extension
Navigation 3 support is optional and works the same on every platform: navigation-desktop for the desktop and navigation-mobile for Android and iOS. rememberPulseContainer is in navigation-desktop only, since mobile has no Container.
| Declaration | Description |
|---|---|
rememberPulseViewModel | ViewModel scoped to a ViewModelStoreOwner |
rememberPulseNavEntryDecorators | NavDisplay decorators that scope ViewModels to a back stack entry |
rememberPulseContainer | Container scoped to a ViewModelStoreOwner (desktop only) |