DF826CF4702D9DCCB9A9DD71/* Pods-1Weather.release.xcconfig */={isa=PBXFileReference;includeInIndex=1;lastKnownFileType=text.xcconfig;name="Pods-1Weather.release.xcconfig";path="Target Support Files/Pods-1Weather/Pods-1Weather.release.xcconfig";sourceTree="<group>";};
DF826CF4702D9DCCB9A9DD71/* Pods-1Weather.release.xcconfig */={isa=PBXFileReference;includeInIndex=1;lastKnownFileType=text.xcconfig;name="Pods-1Weather.release.xcconfig";path="Target Support Files/Pods-1Weather/Pods-1Weather.release.xcconfig";sourceTree="<group>";};
/// Location authorization request doesn't have callbacks, and we want a callback, so that's a hack to be notified of the option selected in the permissions dialog.
// If the location is partially incomplete (e.g. coordinates are missing, or country / city / region), then some of this information will be returned by the weather update, but we may need to consider reverse geocoding here as well, if needed.
// If the location is partially incomplete (e.g. coordinates are missing, or country / city / region), then some of this information will be returned by the weather update, but we may need to consider reverse geocoding here as well, if needed.
iflocations.count>=maxLocationsCount{
iflocations.count>=maxLocationsCount{
log.warning("Adding new location, although the location limit is exceeded. New total: \(locations.count+1)")
log.warning("Adding new location, although the location limit is exceeded. New total: \(locations.count+1)")
// This may happen if a location is added from a push notification.
// This may happen if a location is added from a push notification.
/// True if this location came from the Device GPS (user's current location). False if it was added in some other way (search, push notification, popular cities, etc.)
publicletdeviceLocation:Bool
publicvarlastTimeUpdated:Date
publicvarlastTimeUpdated:Date
publicvarcoordinates:CLLocationCoordinate2D?
publicvarcoordinates:CLLocationCoordinate2D?
publicvarimageName:String?="ny_bridge"//we'll possibly need to switch to URL
publicvarimageName:String?="ny_bridge"//we'll possibly need to switch to URL
...
@@ -65,6 +67,30 @@ public struct Location: Equatable, Hashable {
...
@@ -65,6 +67,30 @@ public struct Location: Equatable, Hashable {
privatestaticletcomparisonAccuracyLimit:CLLocationDegrees=0.00001// approximately 1 meter – more than enough for our purposes. https://en.wikipedia.org/wiki/Decimal_degrees
privatestaticletcomparisonAccuracyDigits=4// 4 digits after the dot, that's approximately 10 meters – should be enough for our purposes. https://en.wikipedia.org/wiki/Decimal_degrees
// no point in comparing hashes first, I think, since making the hash might be as computationally expensive as this whole thing (I didn't profile it though).
// not particularly fast, but it's not a too often used operation in the app, and it's the easiest way to make a comparison with given accuracy, while calculating the hash in a way such that if A == B, then A.hash == B.hash (with our "equal-to-X-digits-after-the-dot" equality implementation).
/// True if this location came from the Device GPS (user's current location). False if it was added in some other way (search, push notification, popular cities, etc.)