Hi there!! Community. I am new to learning KMM and I would like to get your help that how to make a
ComposeUIViewController
get the fun that will have my MapView
This is my fun in the
Shared Module
@Composable
fun SampleMap(view: @Composable () -> Unit) {
Box(modifier = Modifier.fillMaxSize()){
view.invoke()
}
}
and this
actual fun getPlatformName(): String = "iOS"
fun MainViewController() = ComposeUIViewController { App() }
and I want to get this in the IOS code. So how could I do the
_*ComposeUIViewControlle*_r
?
struct MapView: UIViewRepresentable {
let coordinate: CLLocationCoordinate2D
func makeUIView(context: Context) -> MKMapView {
let map = MKMapView()
let region = MKCoordinateRegion(
center: coordinate,
latitudinalMeters: 1000,
longitudinalMeters: 1000)
map.setRegion(region, animated: true)
return map
}
func updateUIView(_ view: MKMapView, context: Context) {
// Update the view as necessary
}
}