Skip to content

GeoView patterns with Jetpack Compose

The ArcGIS Maps SDK for Kotlin empowers developers to build robust, responsive mapping applications using modern programming patterns. By leveraging Jetpack Compose and Kotlin coroutines, you can efficiently manage UI state, configure map components, perform advanced operations, and handle asynchronous tasks for a seamless user experience. The ArcGIS Maps SDK for Kotlin toolkit provides composable MapView and SceneView functions, known collectively as GeoViews, that integrate with Jetpack Compose. In the following pages, MapView is used as an example, but the same principles apply to SceneView.

Here are some best practices for using Android Jetpack Compose and the Kotlin language when developing with the ArcGIS Maps SDK for Kotlin:

  • Manage GeoView state: Jetpack Compose provides a modern, declarative approach to building UI, where you manage the state of maps, scenes, and related data using Compose State and ViewModels. This separation of UI and logic helps keep your code organized and maintainable.

  • Configure a GeoView: The ArcGIS Maps SDK for Kotlin toolkit's geoview-compose library, designed for Jetpack Compose, simplifies the configuration of MapView and SceneView components. You can easily adjust their appearance, behavior, and event handling through parameters and lambda functions, making your UI reactive and flexible.

  • Perform GeoView operations: Advanced operations on MapView and SceneView are supported through proxy classes like MapViewProxy and SceneViewProxy. These proxies expose methods and properties that aren’t suitable for direct use in composable initializers or modifiers, enabling tasks such as identifying features, animating viewpoint changes, converting coordinates, and exporting view snapshots.

  • Concurrent GeoView tasks: Concurrency is essential for responsive mobile apps. The ArcGIS ArcGIS Maps SDK for Kotlin leverages coroutines to handle background tasks like resource loading, service queries, and offline data downloads. In Compose, asynchronous operations are managed using side effects and ViewModel coroutine scopes, ensuring smooth user experiences and robust state management.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.