4.0.7 version
Table of Contents
- What’s New
- Installation
- UIKit
- SwiftUI
- CrowdConnected location provider
- IndoorAtlas location provider
- ExpoFP-GPS location provider
What’s New in ExpoFP Fplan version 4.0.7
Bugs have been fixed.
Installation
Cocoapods:
pod 'ExpoFpFplan', '4.0.7'
UIKit
Usage
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()
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)
Clear floor plan:
fplanUiView.clear()
Events
Floor plan ready event:
fplanUiView.setOnFpReadyCallback {
print("[OnFpReady]")
}
Select booth event:
fplanUiView.setOnBoothClickCallback { id, name in
print("[OnBoothClick] id=\(id); name=\(name)")
}
Route create event:
fplanUiView.setOnBuildDirectionCallback { direction in
print(direction)
}
Details open event:
fplanUiView.setOnDetailsClickCallback { details in
print("[OnDetailsClick]")
print(details)
}
Exhibitor custom button click event:
fplanUiView.setOnExhibitorCustomButtonClickCallback { externalId, buttonNumber, buttonUrl in
print("[OnExhibitorCustomButtonClick] externalId=\(externalId); buttonNumber=\(buttonNumber); buttonUrl=\(buttonUrl)")
}
Navigation
There are 2 ways to use navigation in UIFplanView. The first way is to explicitly specify the provider. In this case, UIFplanView will start and stop the LocationProvider on its own.
let locationProvider: LocationProvider = ...
fplanUiView.load(URL, noOverlay: false, locationProvider: locationProvider)
The second way is to run the GlobalLocationProvider when the program starts:
let locationProvider: LocationProvider = ...
GlobalLocationProvider.initialize(locationProvider)
GlobalLocationProvider.start()
Using the GlobalLocationProvider in the UIFplanView:
fplanUiView.load(URL, noOverlay: false, useGlobalLocationProvider: true)
When the program terminates, the GlobalLocationProvider must also be stopped:
GlobalLocationProvider.stop();
SwiftUI
Usage
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()
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)
Clear floor plan:
fplanView.clear()
Events
Floor plan ready event:
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:
import SwiftUI
import ExpoFpFplan
@main
struct FplanApp: App {
var fplanView = FplanView()
var body: some Scene {
WindowGroup {
VStack
{
fplanView.onBoothClick { id, name in
print("[OnBoothClick] id=\(id); name=\(name)")
}
.onAppear {
fplanView.load("https://demo.expofp.com")
}
.onDisappear {
fplanView.destoy()
}
}
}
}
}
Route create event:
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()
}
}
}
}
}
Details open event:
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()
}
}
}
}
}
Exhibitor custom button click event:
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()
}
}
}
}
}
Navigation
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, noOverlay: false, locationProvider: locationProvider)
The second way is to run the GlobalLocationProvider when the program starts:
let locationProvider: LocationProvider = ...
GlobalLocationProvider.initialize(locationProvider)
GlobalLocationProvider.start()
Using the GlobalLocationProvider in the FplanView:
fplanView.load(URL, noOverlay: false, useGlobalLocationProvider: true)
When the program terminates, the GlobalLocationProvider must also be stopped:
GlobalLocationProvider.stop();
CrowdConnected location provider
Сocoapods:
pod 'ExpoFpCrowdConnected', '4.0.7'
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"))
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
Сocoapods:
pod 'ExpoFpIndoorAtlas', '4.0.7'
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"))
ExpoFP-GPS location provider
Сocoapods:
pod 'ExpoFpGpsProvider', '4.0.7'
Import:
import ExpoFpGpsProvider
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 = new GpsProvider(getApplication())