STLocationManager

Objective-C

@interface STLocationManager : NSObject

Swift

class STLocationManager : NSObject

STLocationManager is a singleton utility class to take of all geo location service methods on top of CLLocationManager. Use this class to get the authorization status of location permission, ask for authorization, start updating as well as stop updating the location pooling.

Properties

  • The last known location fetched by CLLocationManager

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) CLLocation *_Nonnull lastKnownLocation;

    Swift

    var lastKnownLocation: CLLocation { get }

Class Methods

  • Return the shared instance of location manager

    Declaration

    Objective-C

    + (nonnull instancetype)sharedInstance;

    Swift

    class func sharedInstance() -> Self
  • Start updating the location and pool the location when the app is in use.

    Declaration

    Objective-C

    - (void)startUpdatingLocation;

    Swift

    func startUpdatingLocation()
  • Stop updating the location if there is any location fetching request is in the background

    Declaration

    Objective-C

    - (void)stopUpdatingLocation;

    Swift

    func stopUpdatingLocation()
  • To know about the authorization status of location permission..

    Declaration

    Objective-C

    - (BOOL)isAuthorized;

    Swift

    func isAuthorized() -> Bool
  • Ask for location permission to the user.

    Declaration

    Objective-C

    - (void)requestAuthorization;

    Swift

    func requestAuthorization()