ExpoFP is a binary package (XCFramework) to show and manage floor plans.
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"),
]
),
target 'MyApp' do
pod 'ExpoFP', '~> 5.0.0'
end
let expoKey = "YourExpoKey"
let presenter = ExpoFpPlan.createPlanPresenter(with: .expoKey(expoKey))
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
)
let swiftUIView = presenter.getView()
let uiKitViewController = presenter.getViewController()
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))
let downloadedPlansInfo = await ExpoFpPlan.downloader.getDownloadedPlansInfo() // Also awailable with completion
ExpoFpPlan.downloader.removeDownloadedPlan(with: downloadedPlanInfo)
or
ExpoFpPlan.downloader.removeAllDownloadedPlans()
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)
let preloadedPlansInfo = await ExpoFpPlan.preloader.getPreloadedPlansInfo() // Also awailable with completion
ExpoFpPlan.preloader.disposePreloadedPlan(with: preloadedPlanInfo)
or
ExpoFpPlan.preloader.removeAllPreloadedPlans()
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.
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.
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.
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