Mobile SDK
iOS
Setup
7 min
installation to be able to add the toro sdk to your project, you will need access to our github repository, for which we will provide you with an access token recommendation for new projects, we highly recommend using swift package manager for the simplest integration experience for existing cocoapods projects with potential dependency conflicts, consider using the core subspec swift package manager in xcode, select file > add packages enter the repository url in the top right search bar (we will confirm this to you when you begin your integration) when prompted, authenticate with the username and access token we provided select your desired version click "add package" spm will automatically include all necessary dependencies cocoapods create or update your podfile platform \ ios, '12 0' toro repo = 'repository url' # replace with provided url toro version = 'version' # replace with desired version target 'yourapp' do use frameworks! \# option 1 complete integration (recommended) \# includes all dependencies as xcframeworks pod 'torosdk', \ git => toro repo, \ tag => toro version \# option 2 core integration \# for projects needing to manage dependencies separately \# pod 'torosdk/core', \ git => toro repo, \ tag => toro version \# pod 'cryptoswift', ' > 1 3 0' \# pod 'xmlcoder', ' > 0 14 0' \# pod 'alamofire', ' > 5 0' end when using the core integration option, you may need to add this post install hook to your podfile post install do |installer| installer pods project targets each do |target| target build configurations each do |config| config build settings\['build library for distribution'] = 'yes' end end end this ensures proper swift module interfaces are generated without this, you may encounter unresolved symbol errors at run time due to binary compatibility issues to authenticate with github, you can create a netrc in your home directory machine github com login your github username password your github access token alternatively, you can add the credentials directly to macos keychain or by cloning the repository, which will prompt you to enter the credentials run pod install from your project directory manual download the xcframeworks from the github repository in xcode, select your project > target > general tab drag the xcframeworks into the "frameworks, libraries, and embedded content" section ensure "embed & sign" is selected for each framework info plist configuration to use the sdk, you need to define the following in your application's info plist file \<?xml version="1 0" encoding="utf 8"?> \<!doctype plist public " //apple//dtd plist 1 0//en" "http //www apple com/dtds/propertylist 1 0 dtd"> \<plist version="1 0"> \<dict> 	\<! location permissions optional > 	\<key>nslocationalwaysandwheninuseusagedescription\</key> 	\<string>we need your location to process secure payments \</string> 	\<key>nslocationwheninuseusagedescription\</key> 	\<string>we need your location to process secure payments \</string> 	 	\<! bluetooth background modes required to maintain connection with payment terminals > 	\<key>uibackgroundmodes\</key> 	\<array> 	 \<string>bluetooth central\</string> 	 \<string>external accessory\</string> 	\</array> 	 	\<! miura device protocols required to communicate with miura payment terminals > 	\<key>uisupportedexternalaccessoryprotocols\</key> 	\<array> 	 \<string>com miura shuttle\</string> 	 \<string>com miura rpi\</string> 	\</array> 	 	\<! bluetooth usage descriptions required for ios to request bluetooth permission > 	\<key>nsbluetoothalwaysusagedescription\</key> 	\<string>bluetooth is used to connect to payment terminals \</string> 	\<key>nsbluetoothperipheralusagedescription\</key> 	\<string>bluetooth is used to connect to payment terminals \</string> \</dict> \</plist> note that if you would like to collect geolocation for transactions, the permissions must be requested in code at runtime see docid\ gfqiw ehwk1gfris6n6ul for more information initialisation in the sample application, we initialise the toroclient instance in our appdelegate and inject it into our mainviewmodel import uikit import swiftui import torosdk @main class appdelegate nsobject, uiapplicationdelegate { var window uiwindow? func application( application uiapplication, didfinishlaunchingwithoptions launchoptions \[uiapplication launchoptionskey any]? = nil) > bool { let config = appsettings shared gettoroconfig() let toro = toroclient(config config) let mainviewmodel = mainviewmodel(toro toro) window = uiwindow(frame uiscreen main bounds) window? rootviewcontroller = uihostingcontroller( rootview mainview(viewmodel mainviewmodel) ) window? makekeyandvisible() return true } } you can feel free to manage your toroclient instance in any way you wish, as long as it is only initialised once during the lifecycle of your application, e g , wrapping it in a singleton so it is accessible globally
