Files
swift-composable-architectu…/Sources/ComposableCoreLocation/Models/Visit.swift
Brandon Williams 82d2a23e0c ComposableCoreLocation (#120)
* wip

* wip

* wip

* wip

* wip

* basics

* wip

* wip

* wip got LocalSearchClient spm package

* got a common spm package

* basics of desktop

* renamed

* wip

* clean up

* Fix

* clean up

* formatting and remove deprecated

* wip

* move stuff around, readmes

* fix

* clean up

* image

* typo

* docs

* wip

* typo

* rename

* wip

* clean up

* clean up

* rename

* wip

* Update README.md

* custom button

* format

* wip

* fix

* error info

* public interface

* set, alpha

* add error

* fix

* alpha

* internal

* Revert "internal"

This reverts commit 97da6f3086.

* wip

* wip

* docs

* rename

* cleanup

* add fatal error messages to mock

* fixes

* fixes

* clean up

* 13.3 fixes

* another fix

* 13.3 fixes

* wip

* fix mac tests

* wip

* just use double

* fix

* Revert "fix"

This reverts commit 4565a6485f.

* fix

* Fix?

* Fix

* More fix

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2020-05-20 11:12:59 -07:00

48 lines
1.4 KiB
Swift

import CoreLocation
/// A value type wrapper for `CLVisit`. This type is necessary so that we can do equality checks
/// and write tests against its values.
@available(iOS 8, macCatalyst 13, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
public struct Visit: Equatable {
public let rawValue: CLVisit?
public var arrivalDate: Date
public var coordinate: CLLocationCoordinate2D
public var departureDate: Date
public var horizontalAccuracy: CLLocationAccuracy
init(visit: CLVisit) {
self.rawValue = nil
self.arrivalDate = visit.arrivalDate
self.coordinate = visit.coordinate
self.departureDate = visit.departureDate
self.horizontalAccuracy = visit.horizontalAccuracy
}
public init(
arrivalDate: Date,
coordinate: CLLocationCoordinate2D,
departureDate: Date,
horizontalAccuracy: CLLocationAccuracy
) {
self.rawValue = nil
self.arrivalDate = arrivalDate
self.coordinate = coordinate
self.departureDate = departureDate
self.horizontalAccuracy = horizontalAccuracy
}
public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.arrivalDate == rhs.arrivalDate
&& lhs.coordinate.latitude == rhs.coordinate.latitude
&& lhs.coordinate.longitude == rhs.coordinate.longitude
&& lhs.departureDate == rhs.departureDate
&& lhs.horizontalAccuracy == rhs.horizontalAccuracy
}
}