Skip to content

Getting Started

sonmbol edited this page Jul 28, 2026 · 1 revision

Getting Started

Requirements

  • Swift 5.9 or later
  • iOS 15, macOS 11, tvOS 14, or watchOS 7
  • An exported asynchronous state source

Add the package in Xcode:

https://github.com/sonmbol/KMPObservableBridge.git

Link the product matching the application:

Integration Product
SKIE StateFlow KMPObservableBridgeSKIE
KMP-NativeCoroutines KMPObservableBridgeNative
Callback, Combine, custom KMPObservableBridge

SKIE in four steps

Declare current-value interoperability once:

import shared
import KMPObservableBridgeSKIE

extension SkieSwiftStateFlow: @retroactive KMPValueProperty {}

Select observable fields beside the feature:

@KMPObservable(
    ProfileViewModel.self,
    fields: \.profileState
)
extension ProfileViewModel: @retroactive KMPStaticallyObservable {}

Own the ViewModel:

@KMPStateObject
private var profile = ProfileViewModel()

Render a projected current value and call actions on the original model:

Text($profile.profileState.title)

Button("Retry") {
    profile.retry()
}

A writable Kotlin export produces a binding:

TextField("Search", text: $profile.searchText)

Ownership

  • KMPStateObject owns a model for one SwiftUI identity.
  • KMPObservedObject observes a model owned elsewhere.
  • KMPEnvironmentObject consumes an existing projected store.
  • Only an owning wrapper may dispose a Kotlin model.

For a complete application, open the DailyPulse example.

Clone this wiki locally