pauljohanneskraft / Map

MKMapView wrapper for SwiftUI as drop-in to MapKit's SwiftUI view. Easily extensible annotations and overlays, iOS 13 support and backwards compatible with MKAnnotation and MKOverlay!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

watchOS support for overlays?

keyle opened this issue · comments

commented

Hi,

trying to render some images on top of a map on my Apple Watch (rain radar gifs on top of map)

I did this on the web previously and thought, gee, that'd be nice on my wrist!

Having some difficulty trying to render images on the map, I found your library.
After adding it... Found this #if !os(watchOS) ... code ... #endif

Bummer.

So, simple question, is it a case of impossible at the moment or ... something else? It seems deliberate!

thanks for your time,
keyle

commented

This library does not really implement any functionality on its own but is rather a wrapper around the existing APIs that make it a bit more useful for the use with SwiftUI where the APIs in MapKit itself often lack the exposure of functionality that would otherwise be there (e.g. when using WatchKit directly in this case). So, if there is a functionality that is part of WatchKit/MapKit that this library does not provide, let me know.

Okay, now to your concrete question: If you are "only" trying to display images on the map and do not care about map zoom scale, etc - annotations are the way to go (e.g. ImageAnnotation for watchOS). Unfortunately, MapKit on watchOS doesn't know about overlays (talking about MKOverlay here), so we cannot really build it into this library.

commented

I just noticed a current bug about ImageAnnotation that the initializer with an imageNamed parameter does not set the respective value. So, please use ImageAnnotation(coordinate:image:centerOffset:) instead until a fix is released.