Skip to content

Mappls Nearby Search Widget for iOS

Introduction

The MapplsNearbyUI makes it easy to integrate a widget with your iOS application. The Nearby Search widget provided as a means to enable radially search for Nearby Places on Mappls Map.

The widget offers the following basic functionalities:

  • Ability to search for nearby places directly with Mappls Map visual interface.

  • A single method to initiate nearby search across all categories of places available on Mappls.

  • Ability to get information from Mappls Nearby Search widget through a callback.

Widget Preview

This can be done by following simple steps.

Step 1:-

Installation

To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter its repository URL

  https://github.com/mappls-api/mappls-nearby-ui-ios-distribution.git

See Adding Package Dependencies to Your App.

Version History

| Version | Dated | Description | | 2.0.0| 09 Feb 2025 | - Authentication and authorization mechanisms have been revised.| | --- | --- | --- | | :---- | :---- | :---- | | 1.0.2 | 25 Feb 2025 | 'bitcode' disabled to support Xcode 15. |

Dependencies

This library depends upon several Mappls's own libraries. All dependent libraries will be automatically installed using CocoaPods.

Below are list of dependencies which are required to run this SDK:

Authorization

MapplsAPICore

It is required to set Mappls keys to use any Mappls SDK. Please refer the documentation here.

Step 2:-

Launching with default configuration

MapplsNearbyCategoriesViewController

MapplsNearbyCategoriesViewController is type of UIViewController which is entry ViewController for MapplsNearbyUI SDK.

let nearbyUI = MapplsNearbyCategoriesViewController()
self.navigationController?.pushViewController(nearbyUI, animated: false)

Thats all ! you are now ready with the MapplsNearbyUI widget within your app.

To enhance further and making UI as per your own requirements, refer to the section below:

Properties of MapplsNearbyCategoriesViewController

  • nearbyCategories: - An array of an object of type MapplsNearbyCategories which will help to make your own custom categories to show on MapplsNearbyCategoriesViewController.

It can be used as follows.

    var  nearbyCategories = [MapplsNearbyCategories]()

    let  selectedImage = UIImage(named: "placePickerMarker")?.withRenderingMode(.alwaysTemplate)
    let categoriesImage = UIImage(named: "Coffee")

    let coffeeCategory = MapplsNearbyCategories(title: "Coffee", selectedBackgroundColor: selectedColor, unselectedBackgroundColor: .white, selectedImage: selectedImage ?? UIImage(), unselectedImage: selectedImage ?? UIImage(), unselectedTextColor: .black, selectedTextColor: .white, isSelected: true, categoryKeywords: ["FODCOF"], mapNearbyCategoryIcon: categoriesImage)

    nearbyCategories.append(coffeeCategory)

    nearbyUI.nearbyCategories = nearbyCategories

  • nearbyCategoryConfiguration:- A object of type MapplsNearbyCategoryConfiguration which will be required to set the UI Configuration of MapplsNearbyCategoriesViewController

  • nearbyConfiguration:- A object of type MapplsNearbyConfiguration which will be required in MapplsNearbyMapViewController to configure the UI components and nearby request parametes.

  • delegate:- A delegate object of type MapplsNearbyCategoriesViewControllerDelegate to provide different callbacks as per different actions of MapplsNearbyUI.

MapplsNearbyCategoriesViewControllerDelegate

It is a protocol class that will be used for callback methods as shown below:

Call Back Handler

    /// A delegate method which will be called when the user click next button in `MapplsNearbyCategoriesViewController` class
    /// - Parameters:
    ///   - refLocation: It is location selected from place picker  or your current location or location provided by used as refLocation.
    ///   - selectedCategories: It is the array of `MapplsNearbyCategories` items selected from the categories
    ///   - error: This will show an error message in case of any failure in `MapplsNearbyCategoriesViewController` class on next button clicked.

    func didNextButtonClicked(refLocation: String?, selectedCategories: [MapplsNearbyCategories]?, error: String? )
    /// A delegate method will be called when the nearby icon is taped on the map. It will return a nearby response for the taped icon.
    /// - Parameter place: A concrete subclass of `MapplsSuggestion` to represent suggestedLocations object in results of  requests.

    func didSelectNearbyIcon(place: MapplsAtlasSuggestion)
    /// A delegate method will be called when the nearby result in ListView is tapped. It will return a nearby response for the tapped item.
    /// - Parameter place: A concrete subclass of `MapplsSuggestion` to represent suggestedLocations object in results of  requests.

    func didSelectNearbySuggestionFromTable(place: MapplsAtlasSuggestion)

Our many happy customers:

For any queries and support, please contact:

Email us at apisupport@mappls.com

Support Need support? contact us!


@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.