CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

ExpoFP 5.0.0

ExpoFP 5.0.0

Maintained by Nikita.



ExpoFP 5.0.0

  • By
  • ExpoFP

Swift Package Manager compatible CocoaPods Compatible Platform

ExpoFP is a binary package (XCFramework) to show and manage floor plans.

1 Installation

1.1 Swift Package Manager

dependencies: [
    .package(url: "https://github.com/expofp/expofp-sdk-ios", from: "5.0.0"),
]

and then as a dependency for the Package target utilizing ExpoFP:

.target(
    name: "MyApp",
    dependencies: [
        .product(name: "ExpoFP", package: "expofp-sdk-ios"),
    ]
),

1.2 CocoaPods

target 'MyApp' do
    pod 'ExpoFP', '~> 5.0.0'
end

2 Usage

2.1 Load a plan

let expoKey = "YourExpoKey"
let presenter = ExpoFpPlan.createPlanPresenter(with: .expoKey(expoKey))

2.2 Load a plan with additional tools

let expoKey = "YourExpoKey"
let additionalParams = [URLQueryItem(name: "noOverlay", value: "true")]
let locationProvider: IExpoFpLocationProvider = YourLocationProvider() // or Golbal location provider
let messageListener: IExpoFpPlanMessageListener = YourMessageListener()

let presenter = ExpoFpPlan.createPlanPresenter(
    with: .expoKey(expoKey),
    additionalParams: additionalParams,
    locationProvider: locationProvider,
    messageListener: messageListener
)

2.3 Display loaded plan

let swiftUIView = presenter.getView()
let uiKitViewController = presenter.getViewController()

3 Preparing a plan in advance

3.1.1 Download a plan for later use

Plan will be downloaded into cache directory in user domain mask.

Download a plan from the internet:

let expoKey = "YourExpoKey"
let downloadedPlanResult = await ExpoFpPlan.downloader.downloadPlan(withExpoKey: expoKey) // Also awailable with completion
let downloadedPlanInfo = try downloadedPlanResult.get()

let presenter = ExpoFpPlan.createPlanPresenter(with: .downloadedPlanInfo(downloadedPlanInfo))

Unzip from the archive stored in the app:

Archive must be named <expokey>_<version>.zip to identify the plan.

let zipFilePath = Bundle.main.path(forResource: "<expokey>_<version>", ofType: "zip")
let downloadedPlanResult = await ExpoFpPlan.downloader.downloadPlan(withZipFilePath: zipFilePath) // Also awailable with completion
let downloadedPlanInfo = try downloadedPlanResult.get()

let presenter = ExpoFpPlan.createPlanPresenter(with: .downloadedPlanInfo(downloadedPlanInfo))

3.1.2 Get info about all downloaded plans

let downloadedPlansInfo = await ExpoFpPlan.downloader.getDownloadedPlansInfo() // Also awailable with completion

3.1.3 Delete downloaded plans

ExpoFpPlan.downloader.removeDownloadedPlan(with: downloadedPlanInfo)
or
ExpoFpPlan.downloader.removeAllDownloadedPlans()

3.2.1 Preload a plan for later use

All preloaded plans retain their state during app lifecycle and release after app is terminated.

let expoKey = "YourExpoKey"
let preloadedPlanInfo = ExpoFpPlan.preloader.preloadPlan(with: .expoKey(expoKey))
or
let preloadedPlanInfo = ExpoFpPlan.preloader.preloadPlan(with: .downloadedPlanInfo(downloadedPlanInfo))

let presenter = ExpoFpPlan.preloader.getPreloadedPlanPresenter(with: preloadedPlanInfo)

3.2.2 Get info about all preloaded plans

let preloadedPlansInfo = await ExpoFpPlan.preloader.getPreloadedPlansInfo() // Also awailable with completion

3.2.3 Delete preloaded plans

ExpoFpPlan.preloader.disposePreloadedPlan(with: preloadedPlanInfo)
or
ExpoFpPlan.preloader.removeAllPreloadedPlans()

4 Location provider usage

To use Location Provider you must add NSLocationWhenInUseUsageDescription key in your app Info.plist file.
To use Location Provider in background you must also add NSLocationAlwaysUsageDescription key in your app Info.plist file.

4.1 Individual location provider

You need to import Indoor Atlas or Crowd Connected and use their documentation to initialize location provider.
You can use your own location provider after confirming it to IExpoFpLocationProvider protocol.
Plan will call startUpdatingLocation() when it appers and stopUpdatingLocation() when it disappears.

4.2 Global location provider

To use Global location provider you need to set location provider to ExpoFpPlan.globalLocationProvider.sharedProvider instance.
Global location provider is not set to a plan automatically, but you can set ExpoFpPlan.globalLocationProvider to a plan presenter instead of shared instance.
Plan will call startUpdatingLocation() when it appers.
Important: Plan will not call stopUpdatingLocation() when it disappears.

5 Plan management

During plan lifecycle you can use presenter to:

  • Apply new additional params, location provider, message listener;
  • Reload plan with all previously applied params;
  • Monitor loading, initialization and errors via presenter.planStatusPublisher;
  • Zoom, select booth or category, build routes and many more.

Feel free to check out our detailed instructions at expofp.github.io