Issue with userTrackingMode
jearle1974 opened this issue · comments
I tried following the directions in your readme and here online, however I am getting an error when trying to set the userTrackingMode -> Cannot find 'UserTrackingMode' in scope
@State private var userTrackingMode = UserTrackingMode.follow
If I try setting to this
@State private var userTrackingMode = MapUserTrackingMode.follow
I get the following error -> Ambiguous use of 'follow'
Any help would be appreciated.
Unfortunately, there is a name clash between MapKit and this library 😅
There are multiple possible solutions to this problem:
- Remove the
import MapKit
from the file you get the error in. Of course, this will only work, if there is nothing else from MapKit being used in that file that would require the import. - Add a separate file containing the following content and refer to the type
UserTrackingMode
(or whatever you call your typealias) instead ofMapUserTrackingMode
import Map
typealias UserTrackingMode = MapUserTrackingMode
Sorry for the inconvenience.
Will there be a fix for this in the future?
Yes, I simply rename MapUserTrackingMode to UserTrackingMode, I guess
Ah, I just checked and the most recent version on the main branch simply uses MKMapUserTrackingMode instead of defining its own type. Are you using the most recent version and this is still happening?
I was using version upto next major, after changing to main branch it did resolve itself. Thanks for the help and for the awesome code :) Have a great day!
@jearle1974 how did you have resolved the problem, because I'm having the same problem inside the main branch.
@Nickbarbieri1 Can you please try the branch macCatalyst-support
instead? I will merge that one shortly after a bit more testing, but as long as you don't use clustering and macCatalyst (both of them should also work, but the code has not yet been thoroughly tested), it should work perfectly fine. It will not use the MapKit type though, but one that is defined by this library itself
I merged the branch into main
and released version 0.2.0 with the fix 😊