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
}

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift