Skip to content

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.

AssertionDescription
assertPulseMviConventionsThe next twelve checks, in order
assertStatesAreDataTypesA PulseState is a data class or data object
assertMessagesAreSealedOrDataTypesA message is a sealed class with data class / data object cases, or a single data class / data object
assertStatesAndMessagesLiveInContractsStates and messages are in a …Contracts.kt beside their ViewModel or Container
assertViewModelsAndContainersAreNamedAfterTheirBase…ViewModel and …Container
assertViewModelsHoldTheirDataInTheirStateNo var property on a ViewModel or Container
assertViewModelsLiveInContentsA ViewModel lives under content
assertContainersLiveAtTheFeatureRootA Container lives at the feature root
assertHostsComposeContentsA host is named …Host and composes contents instead of binding a ViewModel
assertFeaturePackagesHaveARoleA file in a feature is at its root or under content, section or component
assertContentsBindAViewModelA content binds its ViewModel with PulseContent
assertSectionsAndComponentsArePureSections and components take data and callbacks only
assertSectionsAndComponentsHavePreviewsEvery section and component has a <Name>_Preview
assertPulseMobileConventionsThe checks for an app on mvi-mobile, in order
assertMobileFeaturesHaveOneViewModelA mobile ViewModel is at its feature root and alone there
assertScreensBindTheirViewModelA mobile feature's root composable is a …Screen that binds its ViewModel
assertMobileFeaturePackagesHaveARoleA file in a mobile feature is at its root or under section or component
assertPulseDomainConventionsA repository exposes flows and returns Result<V, E> from one-shot calls; a use case lives in usecase and is more than one line
assertPulseModuleConventionsModules depend on each other the way Clean Architecture asks, and the domain, data and design system are split into packages
assertPulseKoinConventionsKoin modules are declared in the app module
assertPulseResourceConventionsThe domain holds no text, and composables read their text from string resources
PulseModuleLayoutWhich 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.

DeclarationDescription
PulseViewModelAbstract base class that holds one UI state, handles actions and emits events
PulseContentObserves a ViewModel; provides the state and an action dispatcher
PulseStateMarks a class as a ViewModel's UI state
PulseActionMarks a class as a user action
PulseEventMarks a class as a one-time side effect

Desktop ​

These are in mvi-desktop only.

DeclarationDescription
PulseContainerCoordinates the ViewModels of a window
PulseHostScopes a Container to a subtree; enables refresh and broadcast callbacks
PulseBroadcastMarks a class as a Container broadcast message
PulseUnicastMarks 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.

DeclarationDescription
rememberPulseViewModelViewModel scoped to a ViewModelStoreOwner
rememberPulseNavEntryDecoratorsNavDisplay decorators that scope ViewModels to a back stack entry
rememberPulseContainerContainer scoped to a ViewModelStoreOwner (desktop only)

Released under the Apache 2.0 License.