Files
swift-composable-architectu…/Examples/LocationManager/Common/LocalSearchClient/Live.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

24 lines
659 B
Swift

import Combine
import ComposableArchitecture
import MapKit
extension LocalSearchClient {
public static let live = LocalSearchClient(
search: { request in
Effect.future { callback in
MKLocalSearch(request: request).start { response, error in
switch (response, error) {
case let (.some(response), _):
callback(.success(LocalSearchResponse(response: response)))
case (_, .some):
callback(.failure(LocalSearchClient.Error()))
case (.none, .none):
fatalError("It should not be possible that response and error are both nil.")
}
}
}
})
}