or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

composition-lifecycle.mdcomposition-local.mdeffects.mdindex.mdios-integration.mdsnapshot-system.mdstate-management.md
tile.json

tessl/maven-org-jetbrains-compose-runtime--runtime-uikitx64

Compose Multiplatform runtime library for iOS UIKit x64 target providing core runtime functionality for declarative UI framework integration.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.jetbrains.compose.runtime/runtime-uikitx64@1.8.x

To install, run

npx @tessl/cli install tessl/maven-org-jetbrains-compose-runtime--runtime-uikitx64@1.8.0

index.mddocs/

Compose Runtime for iOS UIKit x64

Compose Runtime for iOS UIKit x64 provides the core runtime library for Compose Multiplatform targeting iOS UIKit x64 architecture (iOS simulator on Intel Macs). This runtime enables declarative UI development by providing state management, composition lifecycle, and platform integration capabilities for iOS applications.

Package Information

  • Package Name: org.jetbrains.compose.runtime:runtime-uikitx64
  • Package Type: maven
  • Language: Kotlin
  • Installation: Add to your build.gradle.kts:
dependencies {
    implementation("org.jetbrains.compose.runtime:runtime-uikitx64:1.8.2")
}

Core Imports

import androidx.compose.runtime.*
import androidx.compose.runtime.snapshots.*

Basic Usage

import androidx.compose.runtime.*

@Composable
fun CounterApp() {
    var count by remember { mutableStateOf(0) }
    
    Column {
        Text("Count: $count")
        Button(onClick = { count++ }) {
            Text("Increment")
        }
    }
}

// iOS Integration
fun MainViewController(): UIViewController = ComposeUIViewController { 
    CounterApp() 
}

Architecture

Compose Runtime is built around several key components:

  • State Management: Reactive state system with automatic recomposition triggering
  • Composition Tree: Hierarchical structure representing the UI composition
  • Snapshot System: Efficient state tracking and change detection mechanism
  • Effect System: Lifecycle-aware side effects and resource management
  • Platform Integration: iOS UIKit specific threading and memory management

Capabilities

State Management

Core state management functionality providing reactive state holders and change detection. Essential for building dynamic UIs that respond to data changes.

fun <T> mutableStateOf(value: T): MutableState<T>
fun <T> derivedStateOf(calculation: () -> T): State<T>

interface State<out T> {
    val value: T
}

interface MutableState<T> : State<T> {
    override var value: T
}

State Management

Composition and Lifecycle

Composition management and lifecycle control for building and managing UI component trees. Handles component creation, updates, and disposal.

@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
annotation class Composable

fun <T> remember(calculation: () -> T): T
fun <T> remember(key1: Any?, calculation: () -> T): T

Composition Lifecycle

Effect System

Side effect management with lifecycle-aware execution and automatic cleanup. Provides safe ways to perform operations outside the composition scope.

fun DisposableEffect(
    key1: Any?,
    effect: DisposableEffectScope.() -> DisposableEffectResult
): Unit

fun LaunchedEffect(
    key1: Any?,
    block: suspend CoroutineScope.() -> Unit
): Unit

fun SideEffect(effect: () -> Unit): Unit

Effects

CompositionLocal

Context-like data flow mechanism for passing data implicitly down the composition tree without explicit parameter passing.

abstract class CompositionLocal<T>(defaultFactory: (() -> T)?)
abstract class ProvidableCompositionLocal<T> : CompositionLocal<T>

fun <T> compositionLocalOf(defaultFactory: (() -> T)? = null): ProvidableCompositionLocal<T>
fun <T> staticCompositionLocalOf(defaultFactory: (() -> T)? = null): ProvidableCompositionLocal<T>

@Composable
fun CompositionLocalProvider(
    vararg values: ProvidedValue<*>,
    content: @Composable () -> Unit
): Unit

CompositionLocal

Snapshot System

Low-level snapshot-based state management providing efficient change tracking and transactional state updates.

abstract class Snapshot {
    companion object {
        val global: MutableSnapshot
        val current: Snapshot
        
        fun takeSnapshot(readObserver: ((Any) -> Unit)? = null): Snapshot
        fun takeMutableSnapshot(
            readObserver: ((Any) -> Unit)? = null,
            writeObserver: ((Any) -> Unit)? = null
        ): MutableSnapshot
    }
}

fun <T> snapshotFlow(block: () -> T): Flow<T>

Snapshot System

iOS Integration

Platform-specific integration for embedding Compose Multiplatform in iOS UIKit applications with seamless interoperability.

fun ComposeUIViewController(
    content: @Composable () -> Unit
): UIViewController

fun ComposeUIViewController(
    configure: UIViewController.() -> Unit = {},
    content: @Composable () -> Unit
): UIViewController

@Composable
fun UIKitView(
    factory: () -> UIView,
    modifier: Modifier = Modifier,
    update: (UIView) -> Unit = {}
)

iOS Integration

Error Handling

The runtime can throw the following exceptions:

  • IllegalStateException: When composable functions are called outside of composition context
  • IllegalArgumentException: When invalid parameters are passed to runtime functions
  • ConcurrentModificationException: When snapshot conflicts occur during state updates

Platform-Specific Features

iOS UIKit Integration

  • Threading: Integrates with iOS main thread and run loop
  • Memory Management: Works with iOS ARC and autorelease pools
  • View Hosting: ComposeUIViewController for embedding Compose in UIKit

Performance Considerations

  • State changes trigger minimal recomposition through precise invalidation
  • Snapshot system provides efficient state tracking with structural sharing
  • iOS-specific optimizations for UIKit integration and x64 architecture
  • Automatic memory management with proper UIKit lifecycle integration