Mobile SDK
iOS
MPI Extensibility
1 min
we have exposed the underlying miurasdk (which the torosdk depends on) to allow consuming apps to interact with miura devices for example, if you wanted to show a custom gratuity menu before a transaction, you could show the menu before calling toro starttransaction() and add the tip amount in the transactionmetadata object see more about gratuities docid\ vpdtdno1d9gxrsa ccywp import miurasdk import swiftui import torosdk enum miuradevice { static func showtipmenu( toro toroclient, completion @escaping (result\<int, toroerror>) > void ) { let miura = miuramanager sharedinstance() let tipoptions = \[ (text "1 5%", percentage 5), (text "2 10%", percentage 10), (text "3 15%", percentage 15), (text "4 20%", percentage 20), ] let menuitems = tipoptions map { $0 text } toro opensession { in miura getmenuoption( "my wonderful tip menu!", showstatusbar false, enlargeheader true, enlargefooter false, menuitems menuitems ) { result, value in switch result { case cancelled completion( failure(toroerror customercancelled)) case selected guard let selectedvalue = value, let index = menuitems firstindex(of selectedvalue) else { completion( failure( toroerror unknownerror("invalid tip selection")) ) return } let tippercentage = tipoptions\[index] percentage completion( success(tippercentage)) case timeout completion( failure(toroerror transactiontimeout)) case error completion( failure( toroerror deviceerror( "device returned error response when getting tip" ))) @unknown default completion( failure(toroerror unknownerror("unknown menu result"))) } toro closesession() } } } } note that we recommend using the torosdk methods to open and close sessions with the selected device you could use the miurasdk directly to do this, but managing the session via torosdk means that the sdk maintains visibility over the device connection state while there isn't a strict technical requirement for this approach currently, it provides better integration with the sdk's internal state management and ensures compatibility with future sdk updates that may rely on this session tracking
