iOS UIKit simulator ARM64 utilities for Compose Multiplatform UI framework providing testing, interoperability, and platform-specific implementations.
—
Touch event simulation system for iOS devices, providing hardware-level touch event generation, drag gesture support, and precise touch interaction capabilities.
Core touch event functions for simulating finger interactions on iOS devices.
/**
* Simulates a touch-down event at the specified position
* @param position - Location to touch in density-independent pixels
* @return UITouch instance for further gesture operations
*/
fun UIKitInstrumentedTest.touchDown(position: DpOffset): UITouch
/**
* Simulates a complete tap gesture (touch down + touch up) at specified position
* @param position - Location to tap in density-independent pixels
* @return UITouch instance after completing the tap
*/
fun UIKitInstrumentedTest.tap(position: DpOffset): UITouchUsage Examples:
runUIKitInstrumentedTest {
setContent {
Button(onClick = { /* action */ }) {
Text("Tap me!")
}
}
// Simple tap
tap(DpOffset(100.dp, 200.dp))
// Touch down for complex gestures
val touch = touchDown(DpOffset(50.dp, 50.dp))
// ... perform drag operations with touch
touch.up()
}Advanced drag gesture simulation with duration control and precise positioning.
/**
* Drags touch to target location over specified duration
* @param location - Target location in density-independent pixels
* @param duration - Duration of drag operation (default: 0.5.seconds)
* @return UITouch instance after completing the drag
*/
fun UITouch.dragTo(location: DpOffset, duration: Duration = 0.5.seconds): UITouch
/**
* Drags touch by specified offset from current position over specified duration
* @param offset - Offset to drag by in density-independent pixels
* @param duration - Duration of drag operation (default: 0.5.seconds)
* @return UITouch instance after completing the drag
*/
fun UITouch.dragBy(offset: DpOffset, duration: Duration = 0.5.seconds): UITouch
/**
* Drags touch by specified x and y components over specified duration
* @param dx - Horizontal offset in density-independent pixels (default: 0.dp)
* @param dy - Vertical offset in density-independent pixels (default: 0.dp)
* @param duration - Duration of drag operation (default: 0.5.seconds)
* @return UITouch instance after completing the drag
*/
fun UITouch.dragBy(dx: Dp = 0.dp, dy: Dp = 0.dp, duration: Duration = 0.5.seconds): UITouchUsage Examples:
runUIKitInstrumentedTest {
setContent {
LazyColumn {
items(100) { index ->
Text("Item $index")
}
}
}
// Drag to scroll list
val touch = touchDown(DpOffset(200.dp, 400.dp))
touch.dragTo(DpOffset(200.dp, 100.dp), durationMillis = 500)
touch.up()
// Drag by offset for precise movements
val touch2 = touchDown(DpOffset(100.dp, 100.dp))
touch2.dragBy(DpOffset(50.dp, 100.dp))
touch2.up()
}Low-level touch state management functions for complex gesture sequences.
/**
* Moves touch to new location in window coordinates
* @param location - New location in density-independent pixels
*/
fun UITouch.moveToLocationOnWindow(location: DpOffset)
/**
* Holds touch in stationary phase
* @return UITouch instance after holding
*/
fun UITouch.hold(): UITouch
/**
* Lifts touch, ending the touch interaction
* @return UITouch instance after lifting
*/
fun UITouch.up(): UITouchWindow-level touch operations for precise control over touch event generation.
/**
* Creates a touch event at specified point in window
* @param location - Location in window coordinates as DpOffset
* @return UITouch instance for gesture operations
*/
internal fun UIWindow.touchDown(location: DpOffset): UITouchProperties for accessing touch state and location information.
/**
* Current touch location in hosting view coordinates
*/
val UITouch.location: DpOffsetUsage Example:
runUIKitInstrumentedTest {
val touch = touchDown(DpOffset(100.dp, 100.dp))
println("Touch started at: ${touch.location}")
touch.moveToLocationOnWindow(DpOffset(200.dp, 200.dp))
println("Touch moved to: ${touch.location}")
touch.hold(500) // Hold for half a second
touch.up()
}// Simulate pinch gesture
val touch1 = touchDown(DpOffset(100.dp, 100.dp))
val touch2 = touchDown(DpOffset(200.dp, 200.dp))
// Move touches apart (zoom out)
touch1.dragTo(DpOffset(50.dp, 50.dp))
touch2.dragTo(DpOffset(250.dp, 250.dp))
touch1.up()
touch2.up()// Simulate fling scroll
val touch = touchDown(DpOffset(200.dp, 400.dp))
touch.dragTo(DpOffset(200.dp, 100.dp), durationMillis = 100) // Fast drag
touch.up()// Simulate long press
val touch = touchDown(DpOffset(150.dp, 150.dp))
touch.hold(1000) // Hold for 1 second
touch.up()Install with Tessl CLI
npx tessl i tessl/maven-org-jetbrains-compose-ui--ui-util-uikitsimarm64