or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

accessibility-testing.mdcoordinate-utilities.mdindex.mdios-uikit-testing.mdtouch-simulation.md

index.mddocs/

0

# Compose UI Util for iOS UIKit Simulator ARM64

1

2

Compose UI Util provides essential utilities for iOS UIKit Simulator on ARM64 architecture within the Compose Multiplatform ecosystem. This artifact enables comprehensive testing, interoperability, and platform-specific implementations for iOS applications built with Compose Multiplatform.

3

4

## Package Information

5

6

- **Package Name**: org.jetbrains.compose.ui:ui-util-uikitsimarm64

7

- **Package Type**: maven/gradle

8

- **Language**: Kotlin Multiplatform

9

- **Target Platform**: iOS UIKit Simulator ARM64

10

- **Installation**: Add to your Kotlin Multiplatform project dependencies

11

12

## Core Imports

13

14

```kotlin

15

// Internal testing utilities (for framework development)

16

import androidx.compose.test.utils.UIKitInstrumentedTest

17

import androidx.compose.test.utils.AccessibilityTestNode

18

import androidx.compose.test.utils.runUIKitInstrumentedTest

19

```

20

21

Platform-specific imports for iOS:

22

23

```kotlin

24

import androidx.compose.test.utils.toCGPoint

25

import androidx.compose.test.utils.toDpOffset

26

import androidx.compose.test.utils.center

27

import androidx.compose.test.utils.MockAppDelegate

28

import kotlin.time.Duration

29

import kotlin.time.Duration.Companion.seconds

30

```

31

32

## Basic Usage

33

34

```kotlin

35

// Set up iOS UIKit testing environment

36

runUIKitInstrumentedTest {

37

// Set compose content

38

setContent {

39

Text("Hello, iOS!")

40

}

41

42

// Wait for UI to stabilize

43

waitForIdle()

44

45

// Perform touch interactions

46

tap(center)

47

48

// Verify accessibility tree

49

assertAccessibilityTree {

50

node {

51

label = "Hello, iOS!"

52

}

53

}

54

}

55

```

56

57

## Architecture

58

59

The ui-util-uikitsimarm64 artifact provides several key components:

60

61

- **Testing Infrastructure**: Complete iOS UIKit testing framework with touch simulation and accessibility validation

62

- **Interoperability Layer**: Seamless integration between Compose and UIKit components

63

- **Coordinate System Conversion**: Bidirectional mapping between Compose coordinates and Core Graphics

64

- **Performance Utilities**: Optimized collection operations for UI-intensive operations

65

- **Platform-Specific Implementations**: ARM64-optimized implementations for iOS simulator environment

66

67

## Capabilities

68

69

### iOS UIKit Testing Framework

70

71

Comprehensive testing infrastructure for iOS UIKit applications with Compose integration. Provides touch simulation, accessibility validation, and UI synchronization.

72

73

```kotlin { .api }

74

internal fun runUIKitInstrumentedTest(testBlock: UIKitInstrumentedTest.() -> Unit)

75

76

internal class UIKitInstrumentedTest {

77

val density: Density

78

val screenSize: DpSize

79

val appDelegate: MockAppDelegate

80

val hostingViewController: UIViewController

81

82

fun setContent(

83

configure: ComposeUIViewControllerConfiguration.() -> Unit = {},

84

content: @Composable () -> Unit

85

)

86

fun setContentWithAccessibilityEnabled(content: @Composable () -> Unit)

87

fun waitForIdle(timeoutMillis: Long = 500)

88

fun waitUntil(

89

conditionDescription: String? = null,

90

timeoutMillis: Long = 5_000,

91

condition: () -> Boolean

92

)

93

fun delay(timeoutMillis: Long)

94

fun tearDown()

95

}

96

```

97

98

[iOS UIKit Testing](./ios-uikit-testing.md)

99

100

### Touch and Gesture Simulation

101

102

Touch event simulation system for iOS devices, providing hardware-level touch event generation and drag gesture support.

103

104

```kotlin { .api }

105

fun UIKitInstrumentedTest.touchDown(position: DpOffset): UITouch

106

fun UIKitInstrumentedTest.tap(position: DpOffset): UITouch

107

108

fun UITouch.dragTo(location: DpOffset, duration: Duration = 0.5.seconds): UITouch

109

fun UITouch.dragBy(offset: DpOffset, duration: Duration = 0.5.seconds): UITouch

110

fun UITouch.dragBy(dx: Dp = 0.dp, dy: Dp = 0.dp, duration: Duration = 0.5.seconds): UITouch

111

fun UITouch.moveToLocationOnWindow(location: DpOffset)

112

fun UITouch.hold(): UITouch

113

fun UITouch.up(): UITouch

114

```

115

116

[Touch Simulation](./touch-simulation.md)

117

118

### Accessibility Testing

119

120

iOS accessibility system integration with VoiceOver support and accessibility tree validation.

121

122

```kotlin { .api }

123

internal data class AccessibilityTestNode(

124

var isAccessibilityElement: Boolean? = null,

125

var identifier: String? = null,

126

var label: String? = null,

127

var value: String? = null,

128

var frame: DpRect? = null,

129

var children: List<AccessibilityTestNode>? = null,

130

var traits: List<UIAccessibilityTraits>? = null,

131

var element: NSObject? = null,

132

var parent: AccessibilityTestNode? = null

133

)

134

135

internal fun UIKitInstrumentedTest.getAccessibilityTree(): AccessibilityTestNode

136

internal fun UIKitInstrumentedTest.assertAccessibilityTree(expected: AccessibilityTestNode.() -> Unit)

137

internal fun UIKitInstrumentedTest.findNodeWithTag(tag: String): AccessibilityTestNode

138

internal fun UIKitInstrumentedTest.findNodeWithLabel(label: String): AccessibilityTestNode

139

internal fun AccessibilityTestNode.normalized(): AccessibilityTestNode?

140

fun AccessibilityTestNode.tap(): UITouch

141

fun AccessibilityTestNode.doubleTap(): UITouch

142

```

143

144

[Accessibility Testing](./accessibility-testing.md)

145

146

### Coordinate System Utilities

147

148

Conversion utilities between Compose coordinate systems and iOS Core Graphics coordinates.

149

150

```kotlin { .api }

151

internal fun DpOffset.toCGPoint(): CValue<CGPoint>

152

internal fun CValue<CGPoint>.toDpOffset(): DpOffset

153

internal fun DpRect.toRect(density: Density): Rect

154

internal fun Rect.toDpRect(density: Density): DpRect

155

156

internal fun DpRect.center(): DpOffset

157

internal fun DpRectZero(): DpRect

158

internal fun DpRect.intersect(other: DpRect): DpRect

159

internal fun CValue<CGRect>.toDpRect(): DpRect

160

```

161

162

[Coordinate Utilities](./coordinate-utilities.md)

163

164

165

## Types

166

167

```kotlin { .api }

168

// Core testing types

169

internal class UIKitInstrumentedTest

170

internal data class AccessibilityTestNode

171

internal class MockAppDelegate : NSObject(), UIApplicationDelegateProtocol

172

173

// Touch and gesture types

174

interface UITouch {

175

val location: DpOffset

176

fun moveToLocationOnWindow(location: DpOffset)

177

fun hold(): UITouch

178

fun up(): UITouch

179

fun dragTo(location: DpOffset, duration: Duration = 0.5.seconds): UITouch

180

fun dragBy(offset: DpOffset, duration: Duration = 0.5.seconds): UITouch

181

fun dragBy(dx: Dp = 0.dp, dy: Dp = 0.dp, duration: Duration = 0.5.seconds): UITouch

182

}

183

184

// Coordinate system types

185

typealias DpOffset = androidx.compose.ui.unit.DpOffset

186

typealias DpRect = androidx.compose.ui.unit.DpRect

187

typealias DpSize = androidx.compose.ui.unit.DpSize

188

typealias Density = androidx.compose.ui.unit.Density

189

190

// Platform-specific types

191

typealias UIAccessibilityTraits = kotlin.ULong

192

typealias Duration = kotlin.time.Duration

193

```