An open API service indexing awesome lists of open source software.

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

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
```