https://github.com/0xleif/locationcachestore
CoreLocation Store using CacheStore
https://github.com/0xleif/locationcachestore
cachestore cllocation corelocation swift swiftui
Last synced: 3 months ago
JSON representation
CoreLocation Store using CacheStore
- Host: GitHub
- URL: https://github.com/0xleif/locationcachestore
- Owner: 0xLeif
- Created: 2022-07-21T00:19:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-22T01:51:01.000Z (almost 3 years ago)
- Last Synced: 2025-02-10T23:41:48.922Z (5 months ago)
- Topics: cachestore, cllocation, corelocation, swift, swiftui
- Language: Swift
- Homepage: https://github.com/0xOpenBytes/CacheStore
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LocationCacheStore
*CoreLocation State Store*
## What is [`CacheStore`](https://github.com/0xOpenBytes/CacheStore)?
`CacheStore` is a SwiftUI state management framework that uses a dictionary as the state. Scoping creates a single source of truth for the parent state. `CacheStore` uses [`c`](https://github.com/0xOpenBytes/c), which a simple composition framework. [`c`](https://github.com/0xOpenBytes/c) has the ability to create transformations that are either unidirectional or bidirectional.
## LocationStore
```swift
public typealias LocationStore = Store
```## Keys
```swift
/// `LocationStore` Keys
/// - location: CLLocation
public enum LocationStoreKey {
case location // CLLocation
}
```## Actions
```swift
/// `LocationStore` Actions
public enum LocationStoreAction {
case updateLocation
case locationUpdated(CLLocation?)
}
```## Dependency
```swift
/// `LocationStore` Dependency
public struct LocationStoreDependency {
public var shouldContinuouslyUpdate: Bool
public var updateLocation: () async -> CLLocation?
public init(
shouldContinuouslyUpdate: Bool = true,
updateLocation: @escaping () async -> CLLocation?
) {
self.shouldContinuouslyUpdate = shouldContinuouslyUpdate
self.updateLocation = updateLocation
}
}
```## StoreActionHandler
```swift
/// Higher-order StoreActionHandler
public func locationStoreActionHandler(
withActionHandler actionHandler: StoreActionHandler? = nil
) -> StoreActionHandler
```## DefaultLocationStore
```swift
public class DefaultLocationStore: LocationStore
```