Post marked as unsolved
91
Views
Hello Everyone
choropleth map is possible in swift ios app.where we can fill multiple colour and title and handle click event of map for swift app.
Post marked as unsolved
334
Views
I'm trying to render a MKPolyline on tvOS and get a runtime exception with
_validateTextureView:531: failed assertion `cannot create View from Memoryless texture.'
This same code works fine on the iPad and I'm starting to think it just doesn't work on tvOS...unless this is a beta issue.
Post marked as solved
152
Views
I'm looking for how can I display multiple users in my application, the is question what frameworks can I use or what is the main idea how it works, I started by displaying my location but now I want to display the location of the second users.
thanks
Post marked as unsolved
3.2k
Views
Hey.
I created an app just with Map Kit View, that fills up the whole screen with constraints 0,0,0,0. When i move the map i can see the IconRenderer warnings.
"[Renderer] IconRenderer: HorizontalStretchPadding (18.000000, 18.000000) is larger than the image size (34.000000, 54.000000). Image will now use the center column of pixels to stretch."
Any idea how to get rid of them? I do not have any icons in the app.
Post marked as unsolved
327
Views
I just want to handle a tap on MapAnnotation - https://developer.apple.com/documentation/mapkit/mapannotation in Map - https://developer.apple.com/documentation/mapkit/map.
I've already tried to use usual .onTap modifier, but it didn't work on content passed into MapAnnotation initializer. Also, as I understand, there is no modifier to do something like MKMapViewDelegate.mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) - https://developer.apple.com/documentation/mapkit/mkmapviewdelegate/1452393-mapview does.
So, is there a convenient way to handle a tap, or should I create my own UIViewRepresentable - https://developer.apple.com/documentation/swiftui/uiviewrepresentable for MKMapView - https://developer.apple.com/documentation/mapkit/mkmapview with its own coordinator and do whatever I want with it by interfacing with UIKit?
Post marked as unsolved
235
Views
I already know how to set up map pins or annotations like discussed here: https://developer.apple.com/forums/thread/651668
But the real question is:
How do I replace the hardcoded location data with passed parameters?
This Code is executed without problems, due to the fact that the coords in locations are hardcoded:
import MapKit
struct Location: Identifiable {
let id = UUID()
let name: String
let latitude: Double
let longitude: Double
var coordinate: CLLocationCoordinate2D {
CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
}
}
struct MapView: View {
let locations = [Location(name: "Turtle Rock", latitude: 34.011_286, longitude: -116.166_868)]
var coordinate: CLLocationCoordinate2D
var lat: Double
var long: Double
@State private var region = MKCoordinateRegion()
var body: some View {
Map(coordinateRegion: $region,showsUserLocation: true, annotationItems: locations){ loco in
MapPin(coordinate: loco.coordinate)
}
.onAppear{
setRegion(coordinate)
} .edgesIgnoringSafeArea(.all)
}
private func setRegion(_ coordinate: CLLocationCoordinate2D){
region = MKCoordinateRegion(
center: coordinate,
span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2)
)
}
}
struct MapView_Previews: PreviewProvider {
static var previews: some View {
MapView(coordinate: CLLocationCoordinate2D(latitude: 34.011_286, longitude: -116.166_868),lat: 34.011_286, long: -116.166_868)
}
}
But as soon as I try to use lat(itude) or long(itude) or even coordinate from the passed parameters, I have to use lazy vars and therefore cannot access that mutable getters... any advice?
let locations = [Location(name: "Turtle Rock", latitude: lat, longitude: long)]
//this Throws: Cannot use instance member 'lat' within property initializer; property initializers run before 'self' is available.
//Using lazy var results in: Cannot use mutating getter on immutable value: 'self' is immutable
Post marked as unsolved
1.4k
Views
hello I want to ask questions about the apple maps, I am using apple map SDK development, according to the coordinates for geographic information (- (void) reverseGeocodeLocation: (CLLocation *) location completionHandler: CLGeocodeCompletionHandler completionHandler;)Introduced into China, and I can get the coordinates of the relevant information, and using the coordinates of the abroad (for example: Russia's coordinates) is to get less than the relevant geographic information.What is this why?
Post marked as unsolved
170
Views
I was going thru the apple swiftui course (https://developer.apple.com/tutorials/swiftui/creating-and-combining-views)
and when i was creating a view for the apple map i got this error:
swift:19:35: error: argument passed to call that takes no arguments
Map(coordinateRegion: $region)
import SwiftUI
import MapKit
struct Map: View {
@State private var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 34.011_286, longitude: -116.116_868),
span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2)
)
var body: some View {
Map(coordinateRegion: $region)
}
}
struct Map_Previews: PreviewProvider {
static var previews: some View {
Map()
}
}
Can someone help me with this problem
Post marked as unsolved
188
Views
I want to Use the new Method of integrating maps as of summer 2020, but all I can find online is ways of doing it the old way (with UIViewRepresentable). I can't seem to figure out how to make it work without relying on UIViewRepresentable, which comes from the previous version of Swift. I've looked through the documentation but I cannot see anything built in that would allow me to change the type of the map to satellite. Any info on it would be appreciated.
Here is what I have now:
Swift
import SwiftUI
import MapKit
struct ContentView: View {
@State private var coordinateRegion = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 40.7, longitude: -73.9), span: MKCoordinateSpan(latitudeDelta: 100.0, longitudeDelta: 100.0))
@ViewBuilder var body: some View {
Map(coordinateRegion: $coordinateRegion)
}
}
Post marked as unsolved
125
Views
hello, is it possible to remove or customize the AnnotationView animation when they "enter" or "leave" a cluster?
when I approach a cluster I just want the new AnnotationView to appear without animating the move
Any Suggestion ?
Thank you.
Post marked as solved
221
Views
What constitutes a truly accessible web map requires extensive user research, however as can be seen in the Web map tools WCAG 2.1 evaluation - https://github.com/Malvoz/web-maps-wcag-evaluation/blob/master/README.md (presented by Nic Chan at the 2020 W3C/OGC Joint Workshop Series on Maps for the Web - https://www.w3.org/2020/maps/) there are quite a few opportunities to improve accessibility in the UI of MapKit maps that would immediately benefit the end-user.
In the evaluation report I have deliberately not included any techniques - https://www.w3.org/WAI/WCAG21/Techniques/ sufficient to pass a particular Success Criterion - https://github.com/Malvoz/web-maps-wcag-evaluation/blob/master/README.md#evaluated-success-criteria for brevity, however I am hopeful to see efforts to improve the state of accessibility in MapKit maps!
Thanks.
Post marked as unsolved
185
Views
I search places with the MKLocalSearchCompleter and refine the results when the tableView cell is selected. When a MKLocalSearchCompletion is selected and MKLocalSearch.Request() is started, I get these Errors (example selects Los Angeles):
According to my research this is a very rare problem?! [SearchAttribution] No matching attribution source found for org.volunteermatch ... (+4 other domains)
Error loading attribution info for identifier org.volunteermatch from geod: Error Domain=GEOErrorDomain Code=-8 "No matching attribution source found for org.volunteermatch" UserInfo={NSDebugDescription=No matching attribution source found for org.volunteermatch} ... (+4 other domains)
These are the instance variables in a TableViewController:
var searchCompleter = MKLocalSearchCompleter()
var searchResults = [MKLocalSearchCompletion]()
This code is running everytime the search term is changed:
searchCompleter.queryFragment = text
searchCompleter.resultTypes = .address
searchCompleter.region = region
In tableView … didSelectRowAt… this code is executed:
let selectedItem = searchResults[indexPath.row]
let searchRequest = MKLocalSearch.Request()
searchRequest.naturalLanguageQuery = selectedItem.title
searchRequest.resultTypes = .address
let search = MKLocalSearch(request: searchRequest)
search.start { (response, error) in
guard let coordinate = response?.mapItems[0].placemark.coordinate else {
return
}
// send to mainVC
self.delegate?.userSelectedPlace(coordinate: coordinate)
}
Post marked as unsolved
268
Views
I'm trying to add an MKMapView to my app, and finding it doesn't play nicely with VoiceOver. There are a couple issues.
Issue 1: The order of VoiceOver announcements is unpredictable when swiping through views on the screen. Sometimes the map contents are announced first, sometimes last, sometimes inline (as I would expect) between other views.
I can reproduce this even with a very simple single-view app with a single vertical stack view arranged like:
Top Label
Map View
Bottom Label
Typically, on iPhone, it will announce like:
Map View
Top Label
Bottom Label
And on iPad, it will announce like:
Top Label
Bottom Label
Map View
Issue 2: The order of elements within the map (points of interest, user location, custom annotations, etc) is odd too. It seems to announce all the points of interest first in left-right top-bottom order, followed by annotations and user location.
Is this expected behavior? Has anyone else encountered these issues? Any suggestions? I would prefer not to hide my map from VoiceOver, but if I can't get the behavior under control I might have to.
Thanks!
Mike
Post marked as unsolved
131
Views
Are there any libraries or frameworks for working with raster spatial data? MapKit supports vector data (points, lines, polygons, etc.), but I can't find anything for working on raster spatial data such as remote sensing data or aerial photography.
Post marked as unsolved
83
Views
I am woking on some app where I have integrated the apple's mapkit for map view but here as per my requirement I want to add turn by turn navigation with voice assistant. It will be like from source to destination I want the Map to guide me like turn to left or move forward 10 meters then turn to right etc.
Can any one please help me how is it possible with mapkit. I might be missing some of the features of mapkit framework so please guide me.
Thanks in advance.