Geolocation radius

i need to add a geolocation to a EKEvent and I need a radius I set it to 50.0 but it didn’t alert me what should it be set too?

Replies

You are expecting an alert. Are you doing geofencing ?


With the extremely limited information you provide, all we can say is that it does not do what you expect because you do it wrong … 😉


Seriously, you should provide detailed information if you expect some help:

- what configuration: on device ? simulator ?

- show the code

- tell what you expect where and what you get…

I Am trying to add a radius to my alert on a EKReminder but I can’t figure out what the number needs to be

What do you mean adding radius to the alert ?

in EventKit you can add a location to a reminder alert and it needs a radius

It seems to be well defined here


https://developer.apple.com/documentation/eventkit/ekstructuredlocation


Use the property:

var geoLocation: CLLocation?


Then radius is a propoerty of geoLocation:

var radius: Double

A minimum distance from the core location that would trigger the alarm or reminder.

It is defined as meters.


So you write :


var structuredLocation = EKStructuredLocation(title:"title") //Put your title here
let location = CLLocation(latitude: lat, longitude: long) //use your lat/long vals
structuredLocation.geoLocation = location
structuredLocation.radius = 1000 // 1 KM distance. 
event.structuredLocation = structuredLocation


Credit : https://stackoverflow.com/questions/48597485/how-to-add-location-to-calendar-entry

tthanks 👍

Good, thanks for feedback. Can close the thread.