-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will this library work with KMP and Compose for iOS? #72
Comments
Doesn't seem like |
What is the suggested alternative? |
I have done something like this
|
Thanks for the sample code! I can see that the code is using the native libraries on ios and android. I'm primarily and Android native dev, so iOS is still a bit mysterious for me, especially without having example code to work from. Is there any other special handling to use this code? Like the cocopods setup in this project? Or just a standard google setup? Is there a more complete example of your code that I could reference for this? Im confused about what needs to be in place on the iOS side to make this work. I can handle the Android side. Thanks in advance! |
I'm also in a stage of trail and error to make the maps work on both platforms. As I keep adding more features, I started to have a feel like, it's better to use GoogleMaps View directly and set the view as AndroidView in Compose. This way we have a GoogleMap object which gives us full control and write better code. And regarding integration of Maps in ios, I have used cocoapods. in shared gradle:
After that once you do a gradle sync, you should be able to use GoogleMaps related classes in iosMain of shared module. For API usage, refer official docs https://developers.google.com/maps/documentation/ios-sdk/config |
I have finally got the Android and iOS displaying maps with interactivity. There are some features on iOS that are not working properly, but the basic functionality is implemented. Check out my solution here: https://github.com/realityexpander/ContactsComposeMultiplatform |
I'm new in KMP and Compose, can you guys give me a beginner instruction on how to integrate Google Maps in iOS? |
@sdzshn3 @realityexpander have you ever had the problem that the map is not being rendered at all? It's driving me nuts. This is how the map looks like on my iPhone 15 Pro Simulator. The my location is working but nothing is being rendered/drawn. This is my Kotlin Code: UIKitView(
modifier = modifier,
factory = { GMSMapView() },
update = { view ->
view.myLocationEnabled = isMyLocationEnabled
if (cameraPosition != null) {
view.setCamera(GMSCameraPosition.cameraWithLatitude(cameraPosition.latitude, cameraPosition.longitude, cameraPosition.zoom))
}
},
)
I do set the API key over on iOS in the |
No description provided.
The text was updated successfully, but these errors were encountered: