Files
swift-composable-architectu…/Sources/ComposableCoreLocation/Models/Heading.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

61 lines
1.7 KiB
Swift

import CoreLocation
/// A value type wrapper for `CLHeading`. This type is necessary so that we can do equality checks
/// and write tests against its values.
@available(iOS 3, macCatalyst 13, watchOS 2, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
public struct Heading: Equatable {
public let rawValue: CLHeading?
public var headingAccuracy: CLLocationDirection
public var magneticHeading: CLLocationDirection
public var timestamp: Date
public var trueHeading: CLLocationDirection
public var x: CLHeadingComponentValue
public var y: CLHeadingComponentValue
public var z: CLHeadingComponentValue
init(rawValue: CLHeading) {
self.rawValue = rawValue
self.headingAccuracy = rawValue.headingAccuracy
self.magneticHeading = rawValue.magneticHeading
self.timestamp = rawValue.timestamp
self.trueHeading = rawValue.trueHeading
self.x = rawValue.x
self.y = rawValue.y
self.z = rawValue.z
}
init(
headingAccuracy: CLLocationDirection,
magneticHeading: CLLocationDirection,
timestamp: Date,
trueHeading: CLLocationDirection,
x: CLHeadingComponentValue,
y: CLHeadingComponentValue,
z: CLHeadingComponentValue
) {
self.rawValue = nil
self.headingAccuracy = headingAccuracy
self.magneticHeading = magneticHeading
self.timestamp = timestamp
self.trueHeading = trueHeading
self.x = x
self.y = y
self.z = z
}
public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.headingAccuracy == rhs.headingAccuracy
&& lhs.magneticHeading == rhs.magneticHeading
&& lhs.timestamp == rhs.timestamp
&& lhs.trueHeading == rhs.trueHeading
&& lhs.x == rhs.x
&& lhs.y == rhs.y
&& lhs.z == rhs.z
}
}