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

44 lines
1.1 KiB
Swift

import CoreLocation
/// A value type wrapper for `CLRegion`. This type is necessary so that we can do equality checks
/// and write tests against its values.
public struct Region: Hashable {
public let rawValue: CLRegion?
public var identifier: String
public var notifyOnEntry: Bool
public var notifyOnExit: Bool
init(rawValue: CLRegion) {
self.rawValue = rawValue
self.identifier = rawValue.identifier
self.notifyOnEntry = rawValue.notifyOnEntry
self.notifyOnExit = rawValue.notifyOnExit
}
init(
identifier: String,
notifyOnEntry: Bool,
notifyOnExit: Bool
) {
self.rawValue = nil
self.identifier = identifier
self.notifyOnEntry = notifyOnEntry
self.notifyOnExit = notifyOnExit
}
public static func == (lhs: Self, rhs: Self) -> Bool {
return lhs.identifier == rhs.identifier
&& lhs.notifyOnEntry == rhs.notifyOnEntry
&& lhs.notifyOnExit == rhs.notifyOnExit
}
public func hash(into hasher: inout Hasher) {
hasher.combine(self.identifier)
hasher.combine(self.notifyOnExit)
hasher.combine(self.notifyOnEntry)
}
}