Getting Started: All-in-one

Prerequisites

  1. Add the following frameworks as embedded binaries

    • positioning.framework
    • coremap.framework
    • map.framework
    • mapuikit.framework
  2. Add the following pods to your pod file. Make sure use_frameworks! is added.

    • Alamofire
    • Alamofire-Synchronous
    • SSZipArchive
    • AWSMobileClient
    • AWSS3
  3. Make sure the Mapsted license file is added to your project. If you do not have a license, please contact sales for more information.


Basic Integration

  1. Add location usage description for NSLocationAlwaysUsageDescription key in project's Info.plist file. Location is required in background to support navigation. In Xcode, under app capabilities, enable location updates for background:

  2. Add the following imports:

    • import positioning
    • import map
    • import mapuikit
  3. Add sdk initialization code in AppDelegate:

        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
            MNSettingUtils.setVLog(false)
            MNSettingUtils.setWtfAbort(false)
            MNMapApi.shared.setUp(prefetchProperties: false) {}
            return true
        }
    
  4. Add your view controller as observer for SDK initialized notification. You can present the Mapsted map view controller here. The map will not load until SDK is initialized.

        override func viewDidLoad() {
            super.viewDidLoad()
            MNCoreNotificationManager.main.addObserver(type: .initialized, observer: self, selector: #selector(self.initialized(notification:)))
    
            if let mapsVC = MNMapUIKitViewController.shared as? MNMapUIKitViewController {
                self.mapsVC = mapsVC
                containerVC?.addController(controller: mapsVC, yOffset: 0, isNew: false)
                mapsVC.showLoadingSpinner(text: "Loading...")
            }
        }
    
  5. In the SDK initialized notification handler, you can draw a property and center map on that property.

        @objc func initialized(notification: NSNotification) {
            DispatchQueue.main.async {
                self.mapsVC?.hideLoadingSpinner()
                let propertyInfos = MNPositioningApi.shared.propertyInfos()
                if propertyInfos.count > 0 {
                    self.mapsVC?.selectAndDrawProperty(propertyId: propertyInfos[0].propertyId(), callback: {status in
                        if status {
                                self.mapsVC?.displayPropertyOnMap()
                        }
                    })
                }
            }
        }
    

    The Mapsted map view controller will look like this: