Launch UI on iOS
Overview
Once the SensibillSDK is started, we can launch the Spend Manager UI. Various methods for launching Sensibill UI are available via SMUI.UIProvider
. They allow to launch Sensibill UI with various presentation methods and options.
In most cases UI will be closed by the user interactively. It is possible, however, to also close the UI programmatically.
Discussion
Methods
SDK provides 6 methods for starting the UI, based on presentation style: 3 are suitable for Swift, and symmetrical 3 for Objective-C:
| Presentation Method | Swift | Objective-C |
|---|---|---|
| Modal | start(modalOver:navigationIntent:animated:modalProperties:) | startModal(host:navigationIntentBridge:animated:modalProperties:) |
| Push | start(pushTo:navigationIntent:animated:) | startByPush(host:navigationIntentBridge:animated:) |
| Embed | start(embedIn:navigationIntent:) | startEmbedded(host:navigationIntentBridge:) |
NavigationIntent
In addition to presentation method-specific parameters (will be discussed below), all methods allow to specify the NavigationIntent - the start page for the Sensibill UI.
For most use cases, the navigation intent can be omitted (default), or selected by the integrator based on the vision for the product. The exception is Capture Flow use case, where the integrator has to use .metadataEdit navigation intent. See Capture Flow page for more information.
SMUIProviderDelegate
Optionally you can set a SMUIProviderDelegate for Sensibill UI. If set, the Sensibill UI will provide various events related to Sensibill UI lifecycle.
Steps
- Decide if you need to listen to any of the
SMUIProviderDelegateevents. If so, assign a delegate toSensibillSDK.shared.smui.delegate - Select a presentation method that suits your needs
- Decide if you need to provide
NavigationIntentto this method - Review and adjust other presentation method options.
Example:
class MyViewController: UIViewController {
func showSensibillUI() {
// Step 1 (optional)
SensibillSDK.shared.smui.delegate = ...
// Step 2
SensibillSDK.shared.smui.start(
// ... selected presentation method, see below,
// Step 3 (optional)
navigationIntent: ...,
// Step 4
// ... other parameters
)
}
}Implementation Details
Modal Presentation
- Modal presentation will show Sensibill UI with a separate
UINavigationController, displayed over the provided hostUIViewController. - The Navigation Bar can either be configured by a caller (default), or provided by the SDK
- Optionally, upon startup, the caller can obtain the created
UINavigationControllerand control its lifecycle
For complete information on parameters, see start(modalover:navigationintent:animated:modalproperties:)
Minimal Configuraiton
SensibillSDK.shared.smui.start(
modalOver: self, // assuming self is UIViewController
animated: true
)Full Configuration
This example demonstrates Modal presentation with:
- Initial screen set to Exports List
- Presentation style set to
.overFullScreen - With left navigation bar item shown. This item is not configurable (shows a “Close” button, similar to Close button of the Capture module)
- And a custom menu as a navigation bar right item.
let menu = UIMenu(...)
SensibillSDK.shared.smui.start(
modalOver: self, // assuming self is UIViewController
navigationIntent: .exportList,
animated: true,
modalProperties: SMUI.UIProvider.ModalProperties(
presentationStyle: .overFullScreen,
showLeftNavigationItem: true,
rightNavigationItemMenu: menu
)
)Push Presentation
- This method will push Sensibill UI
UIViewControllerto a provided hostUINavigationController. - The Navigation Bar is handled by a host
UINavigationController. - Optionally, upon startup, the caller can obtain the created
UIViewControllerand control its lifecycle
For complete information on parameters, see start(pushto:navigationintent:animated:)
Example
In this example, in addition to required UINavigationController, the optional NavigationIntent is provided to direct UI to Receipt List start page.
SensibillSDK.shared.smui.start(
pushTo: navigationController, // UINavigationController
navigationIntent: .receiptList,
animated: true
)Embed Presentation
- This method embeds Sensibill UI
UINavigationControllerto a provided hostUIViewController. - The Navigation Bar is handled by a host application.
- Optionally, upon startup, the caller can obtain the created
UINavigationControllerand control its lifecycle
For complete information on parameters, see start(embedin:navigationintent:)
Example
In this example, in addition to required UINavigationController, the optional NavigationIntent is provided to direct UI to Receipt List start page.
SensibillSDK.shared.smui.start(
embedIn: self
)