NearbyUser
This library is used to find nearby user from your current location with respect to your radius.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
- Xcode 6 or later
- iOS 8 or later
Installation
NearbyUser is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'NearbyUser'
Usage
- Objective C
#import "NearbyUser-Swift.h"
- Swift
import NearbyUser
How to use
1.Create object for mapManagers class[which is in pod]
Example:
var mapObject = mapManagers()
2.mapManagers class has below method with returntype of GMSMapView
public func initLocationManagerWithRadiusAndMap(getRadius: String, googleMapView: GMSMapView) -> GMSMapView
{
return GMSMapView
}
usage of the above method is:
gMap = mapObject.initLocationManagerWithRadiusAndMap(getRadius: "yourradiusvalue", googleMapView: gMap)
(in viewDidLoad or wherever based on your preference)
3.mapManagers class has following variables:
/// This variable is used to store all user informatiom from json/api
public var userInformation: [[String: String]] = []
/// This variable is used set custom marker image
public var pinImage = UIImage()
/// This variable is used for placeholder image inside the pin image
public var userPlaceholderImage = UIImage()
/// This variable is used to store the current location of the user
public var currentLocationCoordinates = CLLocationCoordinate2D()
usage of the above variables is:
mapObject.userInformation = "yourData from api/json"
mapObject.pinImage = UIImage(named: "yourImage")!
mapObject.userPlaceholderImage = UIImage(named: "yourImage")!
4.The following methods to get users and marker within the radius
/// This method is to get all users within the radius
/// - Returns: value in [[String: String]]
public func getAllVisibleUserFromRadius() -> [[String: String]]
{
return [[String: String]]
}
/// This method is to get all markers within the radius
/// - Returns: GMSMarker
public func getAllVisibleMarkerFromRadius() -> [GMSMarker]
{
return [GMSMarker]
}
Note:
gMap - outlet of your GMSMapView[used in your project]
mapObject - instance of mapManagers class
Author
RajeshwariU, [email protected]
License
NearbyUser is available under the MIT license. See the LICENSE file for more info.