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

60 lines
1.5 KiB
Swift

import CoreLocation
/// A value type wrapper for `CLBeacon`. This type is necessary so that we can do equality checks
/// and write tests against its values.
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
public struct Beacon: Equatable {
public let rawValue: CLBeacon?
public var accuracy: CLLocationAccuracy
public var major: NSNumber
public var minor: NSNumber
public var proximity: CLProximity
public var rssi: Int
public var timestamp: Date
public var uuid: UUID
public init(rawValue: CLBeacon) {
self.rawValue = rawValue
self.accuracy = rawValue.accuracy
self.major = rawValue.major
self.minor = rawValue.minor
self.proximity = rawValue.proximity
self.rssi = rawValue.rssi
self.timestamp = rawValue.timestamp
self.uuid = rawValue.uuid
}
init(
accuracy: CLLocationAccuracy,
major: NSNumber,
minor: NSNumber,
proximity: CLProximity,
rssi: Int,
timestamp: Date,
uuid: UUID
) {
self.rawValue = nil
self.accuracy = accuracy
self.major = major
self.minor = minor
self.proximity = proximity
self.rssi = rssi
self.timestamp = timestamp
self.uuid = uuid
}
public static func == (lhs: Self, rhs: Self) -> Bool {
return lhs.accuracy == rhs.accuracy
&& lhs.major == rhs.major
&& lhs.minor == rhs.minor
&& lhs.proximity == rhs.proximity
&& lhs.rssi == rhs.rssi
&& lhs.timestamp == rhs.timestamp
&& lhs.uuid == rhs.uuid
}
}