Hi there!! Community. I am new to learning KMM and...
# compose-ios
k
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
Copy code
@Composable
fun SampleMap(view: @Composable () -> Unit) {
    Box(modifier = Modifier.fillMaxSize()){
        view.invoke()
    }
}
and this
Copy code
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
?
Copy code
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
    }
}
I would really appreciate your help🙌
👍 1
j
Do you want MapView inside MainViewController or whats the exact wish of doing here? As MainViewController already is ComposeUiViewVontroller. It sounds like you want reverse interop of using UiKitView in compose and inject MapView into that, or am I wrong?
k
Yes i want to do that to be able to get the Mapview from IOS in my fun SampleMap that is why i would like to find a way to make the ComposeUIViewController for it
I want to make another Controller to the SampleMap fun, because the MainViewController is already used it for another of my composable fun that has the navigation
k
Thank you so much!! @Dima Avdeev I will review it 🙌 🙌