Skip to content

Commit cfc6b0b

Browse files
committed
add viewmodel to the micro app
1 parent 06caed9 commit cfc6b0b

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

microapps/MapComposeApp/app/src/main/java/com/arcgismaps/toolkit/mapcomposeapp/screens/MainScreen.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ import com.arcgismaps.toolkit.geocompose.MapState
2929
@Composable
3030
fun MainScreen() {
3131

32-
val mapState = MapState(arcGISMap = ArcGISMap(BasemapStyle.ArcGISStreets))
32+
val mapModel = MapModel(arcGISMap = ArcGISMap(BasemapStyle.ArcGISImagery))
3333
Map(
3434
modifier = Modifier.fillMaxSize(),
35-
mapState = mapState,
35+
mapState = mapModel.mapState,
3636
)
3737
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2023 Esri
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
package com.arcgismaps.toolkit.mapcomposeapp.screens
19+
20+
import androidx.lifecycle.ViewModel
21+
import com.arcgismaps.mapping.ArcGISMap
22+
import com.arcgismaps.toolkit.geocompose.MapState
23+
24+
class MapModel(
25+
arcGISMap: ArcGISMap
26+
) : ViewModel() {
27+
28+
val mapState: MapState = MapState(arcGISMap)
29+
}

0 commit comments

Comments
 (0)