CLLocationManager
class CLLocationManager : NSObject
To import the CLLocationManager
category:
use_frameworks!
pod CancelForPromiseKit/CoreLocation
And then in your sources:
import PromiseKit import CancelForPromiseKit
-
Request the current location, with the ability to cancel the request.
Note
to obtain a single location usePromise.lastValue
Declaration
Swift
public class func requestLocationCC(authorizationType: RequestAuthorizationType = .automatic, satisfying block: ((CLLocation) -> Bool)? = nil) -> CancellablePromise<[CLLocation]>
Parameters
authorizationType
requestAuthorizationType: We read your Info plist and try to determine the authorization type we should request automatically. If you want to force one or the other, change this parameter from its default value.
block
A block by which to perform any filtering of the locations that are returned. In order to only retrieve accurate locations, only return true if the locations horizontal accuracy < 50
Return Value
A new promise that fulfills with the most recent CLLocation that satisfies the provided block if it exists. If the block does not exist, simply return the last location.