The TikiSdk.present() method currently assumes that it will be called within a specific environment, and this can cause issues when integrating with different applications, using SwiftUI or UIKit.
It would be ideal if the method were agnostic about its environment and could adapt to whatever environment it is called in.
To achieve this, the TikiSdk.present() needs to be modified method to grab the topmost visible view and overlay the whole screen with either a BottomSheetView for bottom sheets or a NavigatorRouteView for screens. This can be done using the UIApplication.shared.keyWindow property to add the overlay.
Here is some sample code that demonstrates how this could be achieved:
if let window = UIApplication.shared.keyWindow {
let overlay = OfferFlow()
overlay.tag = 1001
// add the overlay
window.addSubview(overlay)
// remove itself when completed (this could be passed to the View as a callback)
window.viewWithTag(overlay.tag)?.removeFromSuperview()
}
Implement this modification and test it to ensure that it works in UIKit and SwiftUI
The TikiSdk.present() method currently assumes that it will be called within a specific environment, and this can cause issues when integrating with different applications, using SwiftUI or UIKit.
It would be ideal if the method were agnostic about its environment and could adapt to whatever environment it is called in.
To achieve this, the TikiSdk.present() needs to be modified method to grab the topmost visible view and overlay the whole screen with either a BottomSheetView for bottom sheets or a NavigatorRouteView for screens. This can be done using the UIApplication.shared.keyWindow property to add the overlay.
Here is some sample code that demonstrates how this could be achieved:
Implement this modification and test it to ensure that it works in UIKit and SwiftUI