Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bestiosdeveloper/a858845b93bdcbca230069c9eafe46ab to your computer and use it in GitHub Desktop.
Save bestiosdeveloper/a858845b93bdcbca230069c9eafe46ab to your computer and use it in GitHub Desktop.
let locations = [(latitude: 63.3454, longitude: 12.4543), (latitude: 54.5434, longitude: 23.6434), (latitude: 63.2443, longitude: 23.7545)]
let origin = (latitude: 0.00, longitude: 0.00)
// error: Argument type '(latitude: Double, longitude: Double)' does not conform to expected type 'Equatable'
if locations.contains(origin) {
// do some serious calculations here
}
// error: Referencing instance method 'sorted()' on 'Sequence' requires that '(latitude: Double, longitude: Double)' conform to 'Comparable'
let sortedLocations = locations.sorted()
// error: Type '(latitude: Double, longitude: Double)' does not conform to protocol 'Hashable
let uniqueLocations = Set(locations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment