Skip to content

Instantly share code, notes, and snippets.

View abin0992's full-sized avatar

Abin Baby abin0992

View GitHub Profile
Values which are correctly calculated
Source : CLLocationCoordinate2D(latitude: 42.523261499999997, longitude: 27.432378400000001)
Destination: CLLocationCoordinate2D(latitude: 50.418807999999999, longitude: 30.490086000000002)
Bearing --> 13.8377869254834
Source : CLLocationCoordinate2D(latitude: 40.852899700000002, longitude: 14.332884999999999)
Destination: CLLocationCoordinate2D(latitude: 50.761059600000003, longitude: 8.1405194000000005)
Values which are correctly calculated
//1
Source : CLLocationCoordinate2D(latitude: 39.982261000000001, longitude: 32.555914899999998)
Destination: CLLocationCoordinate2D(latitude: 50.761059600000003, longitude: 8.1405194000000005)
Bearing --> 3.70469770806337
//2
Source : CLLocationCoordinate2D(latitude: -26.073920000000001, longitude: 28.235959999999999)
Destination: CLLocationCoordinate2D(latitude: 40.852899700000002, longitude: 14.332884999999999)
//: A MapKit based Playground
import MapKit
import PlaygroundSupport
var points: [Any] = []
class MapDelegate: NSObject, MKMapViewDelegate {
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
guard let myAnnotation = annotation as? MKPointAnnotation else {
@abin0992
abin0992 / gist:2487928e6c4f9ba2f88604a47a63d27c
Last active August 26, 2018 23:19
Code to compress a string in Swift. Example : AAABBACC to A3B2AC2
// String to compress
let stringtoCompress = "AAABBACC"
// Empty string to store compressed value
var compressedString = ""
// Store the letter count to append in compressed string
var letterCountStored:Int
//Initially letterCountStored is set to 0