Check particular region has my lattitude and longitude iOS swift
Problem:
I had my latitude and longitude and i want to check it was nearby to the other coordinate(lattitude and longitude).
Solution:
let region = CLCircularRegion(center: CLLocationCoordinate2D(latitude: (atitude), longitude: (longitide)), radius: CLLocationDistance(radius), identifier: "")
if region.contains(CLLocationCoordinate2DMake(lat, long)) == true{
//if it contains that region for example if you give the radius as 100 then the other lat and long had inside that region it willl returns true
}
I had my latitude and longitude and i want to check it was nearby to the other coordinate(lattitude and longitude).
Solution:
let region = CLCircularRegion(center: CLLocationCoordinate2D(latitude: (atitude), longitude: (longitide)), radius: CLLocationDistance(radius), identifier: "")
if region.contains(CLLocationCoordinate2DMake(lat, long)) == true{
//if it contains that region for example if you give the radius as 100 then the other lat and long had inside that region it willl returns true
}
Comments
Post a Comment