Link Search Menu Expand Document

4.3.1 version

Table of Contents

What’s New in ExpoFP Fplan version 4.3.1

The ability to download packages from SPM has been added.

Installation

Cocoapods:

pod 'ExpoFpFplan', '4.3.1'

SPM: https://github.com/expofp/expofp-fplan-ios-spm

UIKit

This documentation block describes all the features and functions of ExpoFP SDK for the UIKit platform.

Usage

Init UIFplanView

import UIKit
import ExpoFpFplan

class ViewController: UIViewController {
    var fplanUiView: UIFplanView!

    override func loadView() {
        fplanUiView = UIFplanView()
        self.view = fplanUiView
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        fplanUiView.load("https://demo.expofp.com")
    }

    override func viewWillDisappear(_ animated: Bool) {
        fplanUiView.destoy()
    }
}

Stop UIFplanView

After you finish working with UIFplanView, you need to stop it.
To do this, you need to call the ‘destroy’ function:

fplanUiView.destoy()

Offline mode

ExpoFP SDK provides the following offline modes:

  1. Default - ExpoFP SDK itself caches all the necessary data during the initial loading of the plan.

  2. Opening a zip archive with a plan - you can download the plan archive from the “Integration options” page (windows section), add this archive to your application (Resources.bundle) and then open this plan using the “openZip()” function.

Example:

import UIKit
import ExpoFpFplan

class ViewController: UIViewController {
    var fplanUiView: UIFplanView!

    override func loadView() {
        fplanUiView = UIFplanView()
        self.view = fplanUiView
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let zipFilePath = Bundle.main.path(forResource: "Resources.bundle/demo", ofType: "zip")!
        fplanUiView.openZip(zipFilePath)
    }

    override func viewWillDisappear(_ animated: Bool) {
        fplanUiView.destoy()
    }
}
  1. In the UIFplanView.load() method, it is possible to specify the path to the offline archive with the plan. This archive will be opened automatically in case of poor or no internet connection.
import UIKit
import ExpoFpFplan

class ViewController: UIViewController {
    var fplanUiView: UIFplanView!

    override func loadView() {
        fplanUiView = UIFplanView()
        self.view = fplanUiView
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let zipFilePath = Bundle.main.path(forResource: "Resources.bundle/demo", ofType: "zip")!
        fplanUiView.load("https://demo.expofp.com/", settings: Settings(), offlineZipFilePath: zipFilePath)
    }

    override func viewWillDisappear(_ animated: Bool) {
        fplanUiView.destoy()
    }
}

Settings сlass

The Settings class contains all the parameters necessary for the initialization and operation of the plan.

Parameters passed to the constructor

  • locationProvider(LocationProvider, optional) - location provider. The default value for this parameter is nil.
fplanUiView.load("https://demo.expofp.com/", settings: Settings(locationProvider: GpsProvider()))
  • useGlobalLocationProvider(boolean) - a parameter indicating that the global location provider should be used. The default value for this parameter is false.
fplanUiView.load("https://demo.expofp.com/", settings: Settings(useGlobalLocationProvider: true))
  • focusOnLocation(boolean) - a parameter that activates autofollowing the blue dot. The default value for this parameter is false.
fplanUiView.load("https://demo.expofp.com/", settings: Settings(locationProvider: GpsProvider(), focusOnLocation: true))
  • focusOnFirstLocation(boolean) - a parameter that activates focusing when only the blue dot is displayed for the first time. If the value of the parameter is true, the plan will focus on the blue dot only once when it appears on the map. The default value for this parameter is false.
fplanUiView.load("https://demo.expofp.com/", settings: Settings(locationProvider: GpsProvider(), focusOnFirstLocation: true))

Functions

Open plan:

fplanUiView.load("https://demo.expofp.com")

Stop UIFplanView:

fplanUiView.destoy()

Select booth:

fplanUiView.selectBooth("720")

Select exhibitor:

fplanUiView.selectExhibitor("RPMXPO")

Build route:

fplanUiView.selectRoute(Route(from: "720", to: "751", exceptInaccessible: false))

Set current position(Blue-dot):

fplanUiView.setCurrentPosition(BlueDotPoint(x: 22270, y: 44900), true)

Show/hide layer:

fplanUiView.updateLayerVisibility(layer: "2", visible: false)

Set bookmarks:

fplanUiView.setBookmarks(bookmarks: [Bookmark])
Bookmark properties:
  • name(String) - Name
  • bookmarked(Bool) - Flag indicating if bookmark is bookmarked

Clear floor plan:

fplanUiView.clear()

Get exhibitor list

fplanUiView.exhibitorsList { exhibitors in
}
Exhibitor properties:
  • id(Int) - exhibitor id
  • name(String) - exhibitor name
  • externalId(String) - exhibitor external id
  • booths([Int]) - booth ids

Get category list

fplanUiView.categoriesList { categories in
}
Category properties:
  • id(Int) - category id
  • name(String) - category name
  • exhibitors([Int]) - exhibitor ids

Get booth list

fplanUiView.boothsList { booths in
}
Booth properties:
  • id(Int) - booth id
  • name(String) - booth name
  • externalId(String) - booth external id
  • isSpecial(Bool) - true if booth is special
  • exhibitors([Int]) - exhibitor ids

Events

Floor plan ready event

This event is called when the plan initialization process has successfully completed.

fplanUiView.setOnFpReadyCallback {
   print("[OnFpReady]")      
}

Floor plan init error event

This event is called when an error occurs while initializing the plan.

fplanUiView.setOnFpErrorCallback { errorCode, description in
   print("[OnFpError] errorCode=\(errorCode); description=\(description)")      
}

Select booth event

This event is called when a booth is clicked.

fplanUiView.setOnBoothClickCallback { id, name, externalId in
   print("[OnBoothClick] id=\(id); name=\(name)")
}

Route create event

This event is called when the route is successfully built.

fplanUiView.setOnBuildDirectionCallback { direction in
    print(direction)
}
Direction properties:
  • from(DirectionBooth) - start booth
  • to(DirectionBooth) - destination booth
  • distance(String) - information about distances, for example: 15m
  • time(TimeInterval) - estimated time to final destination booth in seconds
  • lines([Line]) - Lines
DirectionBooth properties:
  • id(String) - booth id
  • name(String) - booth name
Line properties:
  • startPoint(Point) - Line start point
  • endPoint(Point) - Line end point
  • weight(Int) - Line weight
Point properties:
  • x(Int) - X
  • y(Int) - Y
  • layer(String?) - Layer

Details open event

This event is called when opening a panel with information, it can be a panel with information about an open booth, a route, etc.

fplanUiView.setOnDetailsClickCallback { details in
   print("[OnDetailsClick]")
   print(details)
}
Details properties:
  • type(String) - "booth" | "exhibitor" | "route"
  • id(Int) - booth id | exhibitor id | null for route
  • name(String) - booth name | exhibitor name | null for route
  • externalId(String) - booth externalId | exhibitor externalId | null for route
  • boothsNames(String[]) - booth names

Exhibitor custom button click event

This event is called after clicking a custom button in the panel with information about the exhibitor.

fplanUiView.setOnExhibitorCustomButtonClickCallback { externalId, buttonNumber, buttonUrl in
   print("[OnExhibitorCustomButtonClick] externalId=\(externalId); buttonNumber=\(buttonNumber); buttonUrl=\(buttonUrl)")
}

Bookmark click event

This event is called when a bookmark is bookmarked(unbookmarked).

fplanUiView.setOnBookmarkClickCallback { bookmark in
}
Bookmark properties:
  • name(String) - Name
  • bookmarked(Bool) - Flag indicating if bookmark is bookmarked

Festivals

Init UIFplanView

import UIKit
import ExpoFpFplan

class ViewController: UIViewController {
    var fplanUiView: UIFplanView!

    override func loadView() {
        fplanUiView = UIFplanView()
        self.view = fplanUiView
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        fplanUiView.load("https://fest-digitalx23.expofp.com")
    }

    override func viewWillDisappear(_ animated: Bool) {
        fplanUiView.destoy()
    }
}

Stop UIFplanView

After you finish working with UIFplanView, you need to stop it.
To do this, you need to call the ‘destroy’ function:

fplanUiView.destoy()

Festival events

‘Directions’ button click event

This event is called after clicking a ‘Directions’ button in the panel with information about the exhibitor.

fplanUiView.setOnFestDirectionsClick { id, url in
    print("[OnFestDirectionsClick] id: \(id); url: \(url)")
}

‘More details’ button click event

This event is called after clicking a ‘More details’ button in the panel with information about the exhibitor.

fplanUiView.setOnFestMoreDetailsClickCallback { id in
   print("[OnFestMoreDetailsClick] id: \(id)")
}

SwiftUI

This documentation block describes all the features and functions of ExpoFP SDK for the SwiftUI platform.

Usage

Init FplanView

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onAppear{
                    fplanView.load("https://demo.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}

Stop FplanView

After you finish working with FplanView, you need to stop it.
To do this, you need to call the ‘destroy’ function:

fplanView.destoy()

Offline mode

ExpoFP SDK provides the following offline modes:

  1. Default - ExpoFP SDK itself caches all the necessary data during the initial loading of the plan.

  2. Opening a zip archive with a plan - you can download the plan archive from the “Integration options” page (windows section), add this archive to your application (Resources.bundle) and then open this plan using the “openZip()” function.

Example:

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onAppear{
                    let zipFilePath = Bundle.main.path(forResource: "Resources.bundle/demo", ofType: "zip")!
                    fplanView.openZip(zipFilePath)
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}
  1. In the FplanView.load() method, it is possible to specify the path to the offline archive with the plan. This archive will be opened automatically in case of poor or no internet connection.
import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onAppear{
                    let zipFilePath = Bundle.main.path(forResource: "Resources.bundle/demo", ofType: "zip")!
                    fplanView.load("https://demo.expofp.com", settings: Settings(), offlineZipFilePath: zipFilePath)
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}

Settings сlass

The Settings class contains all the parameters necessary for the initialization and operation of the plan.

Parameters passed to the constructor

  • locationProvider(LocationProvider, optional) - location provider. The default value for this parameter is nil.
fplanView.load("https://demo.expofp.com/", settings: Settings(locationProvider: GpsProvider()))
  • useGlobalLocationProvider(boolean) - a parameter indicating that the global location provider should be used. The default value for this parameter is false.
fplanView.load("https://demo.expofp.com/", settings: Settings(useGlobalLocationProvider: true))
  • focusOnLocation(boolean) - a parameter that activates autofollowing the blue dot. The default value for this parameter is false.
fplanView.load("https://demo.expofp.com/", settings: Settings(locationProvider: GpsProvider(), focusOnLocation: true))
  • focusOnFirstLocation(boolean) - a parameter that activates focusing when only the blue dot is displayed for the first time. If the value of the parameter is true, the plan will focus on the blue dot only once when it appears on the map. The default value for this parameter is false.
fplanView.load("https://demo.expofp.com/", settings: Settings(locationProvider: GpsProvider(), focusOnFirstLocation: true))

Functions

Open plan:
fplanView.load("https://demo.expofp.com")
Stop FplanView:
fplanView.destoy()
Select booth:
fplanView.selectBooth("720")
Select exhibitor:
fplanView.selectExhibitor("RPMXPO")
Build route:
fplanView.selectRoute(Route(from: "720", to: "751", exceptInaccessible: false))
Set current position(Blue-dot):
fplanView.setCurrentPosition(BlueDotPoint(x: 22270, y: 44900), true)

Show/hide layer:

fplanView.updateLayerVisibility(layer: "2", visible: false)

Set bookmarks:

fplanView.setBookmarks(bookmarks: [Bookmark])
Bookmark properties:
  • name(String) - Name
  • bookmarked(Bool) - Flag indicating if bookmark is bookmarked
Clear floor plan:
fplanView.clear()

Get exhibitor list

fplanView.exhibitorsList { exhibitors in
}
Exhibitor properties:
  • id(Int) - exhibitor id
  • name(String) - exhibitor name
  • externalId(String) - exhibitor external id
  • booths([Int]) - booth ids

Get category list

fplanView.categoriesList { categories in
}
Category properties:
  • id(Int) - category id
  • name(String) - category name
  • exhibitors([Int]) - exhibitor ids

Get booth list

fplanView.boothsList { booths in
}
Booth properties:
  • id(Int) - booth id
  • name(String) - booth name
  • externalId(String) - booth external id
  • isSpecial(Bool) - true if booth is special
  • exhibitors([Int]) - exhibitor ids

Events

Floor plan ready event

This event is called when the plan initialization process has successfully completed.

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onFpReady {
                    print("[OnFpReady]")
                }
                .onAppear {
                    fplanView.load("https://demo.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}

Select booth event

This event is called when a booth is clicked.

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onBoothClick { id, name, externalId in
                    print("[OnBoothClick] id=\(id); name=\(name)")
                }
                .onAppear {
                    fplanView.load("https://demo.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}

Route create event

This event is called when the route is successfully built.

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onBuildDirection { direction in
                    print(direction)
                }
                .onAppear {
                    fplanView.load("https://demo.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}
Direction properties:
  • from(DirectionBooth) - start booth
  • to(DirectionBooth) - destination booth
  • distance(String) - information about distances, for example: 15m
  • time(TimeInterval) - estimated time to final destination booth in seconds
  • lines([Line]) - Lines
DirectionBooth properties:
  • id(String) - booth id
  • name(String) - booth name
Line properties:
  • startPoint(Point) - Line start point
  • endPoint(Point) - Line end point
  • weight(Int) - Line weight
Point properties:
  • x(Int) - X
  • y(Int) - Y
  • layer(String?) - Layer

Details open event

This event is called when opening a panel with information, it can be a panel with information about an open booth, a route, etc.

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onDetailsClick { details in
                     print("[OnDetailsClick]")
                     print(details)
                }
                .onAppear {
                    fplanView.load("https://demo.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}
Details properties:
  • type(String) - "booth" | "exhibitor" | "route"
  • id(Int) - booth id | exhibitor id | null for route
  • name(String) - booth name | exhibitor name | null for route
  • externalId(String) - booth externalId | exhibitor externalId | null for route
  • boothsNames(String[]) - booth names

Exhibitor custom button click event

This event is called after clicking a custom button in the panel with information about the exhibitor.

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onExhibitorCustomButtonClick { externalId, buttonNumber, buttonUrl in
                    print("[OnExhibitorCustomButtonClick] externalId=\(externalId); buttonNumber=\(buttonNumber); buttonUrl=\(buttonUrl)")
                }
                .onAppear {
                    fplanView.load("https://demo.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}

Bookmark click event

This event is called when a bookmark is bookmarked(unbookmarked).

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onBookmarkClick { bookmark in
                }
                .onAppear {
                    fplanView.load("https://demo.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}
Bookmark properties:
  • name(String) - Name
  • bookmarked(Bool) - Flag indicating if bookmark is bookmarked

Festivals

Init FplanView

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onAppear{
                    fplanView.load("https://fest-digitalx23.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}

Stop FplanView

After you finish working with FplanView, you need to stop it.
To do this, you need to call the ‘destroy’ function:

fplanView.destoy()

Festival events

‘Directions’ button click event

This event is called after clicking a ‘Directions’ button in the panel with information about the exhibitor.

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onFestDirectionsClick { id, url in
                    print("[OnFestDirectionsClick] id: \(id); url: \(url)")
                }
                .onAppear {
                    fplanView.load("https://fest-digitalx23.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}

‘More details’ button click event

This event is called after clicking a ‘More details’ button in the panel with information about the exhibitor.

import SwiftUI
import ExpoFpFplan

@main
struct FplanApp: App {
    
    var fplanView = FplanView()
    
    var body: some Scene {
        WindowGroup {
            VStack
            {
                fplanView.onFestMoreDetailsClick { id in
                    print("[OnFestMoreDetailsClick] id: \(id)")
                }
                .onAppear {
                    fplanView.load("https://fest-digitalx23.expofp.com")
                }
                .onDisappear {
                    fplanView.destoy()
                }
            }
        }
    }
}

There are 2 ways to use navigation in FplanView. The first way is to explicitly specify the provider. In this case, FplanView will start and stop the LocationProvider on its own.

let locationProvider: LocationProvider = ...
fplanView.load(URL, locationProvider: locationProvider)

The second way is to run in the background using GlobalLocationProvider when the program starts.

GlobalLocationProvider

Very often needed to run a location provider in the background, ExpoFP SDK has a GlobalLocationProvider for this. The GlobalLocationProvider runs once at program startup and work in the background.

let locationProvider: LocationProvider = ...
GlobalLocationProvider.initialize(locationProvider)
GlobalLocationProvider.start()

Using the GlobalLocationProvider in the UIFplanView(UIKit):

fplanUiView.load(URL, useGlobalLocationProvider: true)

Using the GlobalLocationProvider in the FplanView(SwiftUI):

fplanView.load(URL, useGlobalLocationProvider: true)

When the program terminates, the GlobalLocationProvider must also be stopped:

GlobalLocationProvider.stop();

CrowdConnected location provider

Setup

Сocoapods:

pod 'ExpoFpCrowdConnected', '4.3.1'

SPM: https://github.com/expofp/expofp-crowdconnected-ios-spm

Import:

import ExpoFpCrowdConnected

Permissions(in Info.plist file):

<key>UIBackgroundModes</key>
<array>
	<string>location</string>
</array>

<key>NSLocationAlwaysUsageDescription</key>
<string>Platform location requested for better indoor positioning experience.</string>

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Platform location requested for better indoor positioning experience.</string>

<key>NSLocationWhenInUseUsageDescription</key>
<string>Platform location requested for better indoor positioning experience.</string>

Initialization:

let locationProvider: LocationProvider = CrowdConnectedProvider(Settings("APP_KEY", "TOKEN", "SECRET"))

Settings

Constructor parameters:

  • appKey(String) - Your Crowd Connected App Key
  • token(String) - Your Crowd Connected Token
  • secret(String) - Your Crowd Connected Secret
  • mode(Mode) - IPS_ONLY | GPS_ONLY | IPS_AND_GPS
  • aliases([String: String]) - Aliases
  • enableNavigation([Bool]) - if true this increases the frequency of GPS location updates.

Functions:

  • addAlias(String key, String value) - add alias

When using CrowdConnectedProvider, it is recommended to run it in the background (when the program starts) using the GlobalLocationProvider.

let locationProvider: LocationProvider = CrowdConnectedProvider(Settings("APP_KEY", "TOKEN", "SECRET"))
GlobalLocationProvider.initialize(locationProvider)
GlobalLocationProvider.start()

On initial startup, the CrowdConnectedProvider checks for permissions, if the permissions are delegated by the user then the CrowdConnectedProvider starts running, if there are no permissions, the CrowdConnectedProvider waits for any plan to open and requests the necessary permissions after the plan is opened. When opening a plan, you must specify “useGlobalLocationProvider” in the settings:

UIFplanView(UIKit):

fplanUiView.load(URL, useGlobalLocationProvider: true)

FplanView(SwiftUI):

fplanView.load(URL, useGlobalLocationProvider: true)

When the program terminates, the GlobalLocationProvider must also be stopped:

GlobalLocationProvider.stop();

Aliases

let settings = ExpoFpCrowdConnected.Settings("APP_KEY", "TOKEN", "SECRET")
settings.addAlias("KEY_1", "VALUE_1")
settings.addAlias("KEY_2", "VALUE_2")
let locationProvider: LocationProvider = CrowdConnectedProvider(settings)

IndoorAtlas location provider

Setup

Сocoapods:

pod 'ExpoFpIndoorAtlas', '4.3.1'

SPM: https://github.com/expofp/expofp-indooratlas-ios-spm

Import:

import ExpoFpIndoorAtlas

Permissions(in Info.plist file):

<key>UIBackgroundModes</key>
<array>
    <string>location</string>
</array>

<key>NSLocationAlwaysUsageDescription</key>
<string>Platform location requested for better indoor positioning experience.</string>

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Platform location requested for better indoor positioning experience.</string>

<key>NSLocationWhenInUseUsageDescription</key>
<string>Platform location requested for better indoor positioning experience.</string>

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Bluetooth requested for better positioning experience.</string>

<key>NSBluetoothPeripheralUsageDescription</key>
<string>Bluetooth requested for better positioning experience.</string>

Initialization:

let locationProvider: LocationProvider = IndoorAtlasProvider(Settings("API_KEY", "API_SECRET_KEY"))