Get Started
Install Guides
Swift
you can integrate the ditto sdk into swift projects to develop native apps for apple ios and macos platforms to install the ditto sdk and start syncing offline confirm that you meet the minimum requirements ( /#prerequisites ) install the necessary dependencies ( /#adding package dependencies ) set up your app permissions ( /#configuring permissions ) authenticate with the big peer and then start syncing offline ( /#integrating and initializing sync ) prerequisites following are the minimum requirements that must be met before attempting to install ditto ios version 14 macos version 11 adding package dependencies from your project in xcode click file and then select add packages from the menu in the recently used dialog box, copy paste the following url into the search box located in the upper right corner https //github com/getditto/dittoswiftpackage for more information, see the official apple documentation > https //developer apple com/documentation/xcode/adding package dependencies to your app#3512138 click to select dittoobjc and dittoswift > and then click add package before installing ditto using cocoapods dependency manager, do the following make sure you have cocoapods version 1 1 0 or later installed for installation and upgrade instructions, see the official cocoapods https //guides cocoapods org/using/getting started html#installation guide in your project's podfile, add the line use frameworks! to indicate that you want to use dynamic frameworks for the pods you're integrating add the dittoswift framework with version 4 3 0 by running the following in your project directory pod 'dittoswift', '=4 3 0' run the following to install the latest version of the dependencies pod install repo update configuring permissions once you've added dependencies from xcode, add a new custom ios target properties entry from the left navigator area, click your project in the editor that appears, click info tab right click any row in the list, and then select add row from the menu for instructions on configuring permissions for your app, see docid\ fpfwbcdcobbxiobmgctll from your project's info plist file, add the following key value pairs, and then, if applicable, modify each string assigned to value once implemented, the following string values display as a prompt to your end users explaining why the app requires certain permissions if your end users prefer a language other than english, replace the string values with their language equivalents setting the data protection entitlement to nsfileprotectioncomplete may lead to a crash to mitigate the crash, set the data protection entitlement to nsfileprotectioncompleteuntilfirstuserauthentication key nsbluetoothalwaysusagedescription type string value uses bluetooth to connect and sync with nearby devices key nsbluetoothperipheralusagedescription type string value uses bluetooth to connect and sync with nearby devices key nslocalnetworkusagedescription type string value uses wifi to connect and sync with nearby devices key nsbonjourservices type array value item0 " http alt tcp " (string)\<key>nsbluetoothalwaysusagedescription\</key> \<string>uses bluetooth to connect and sync with nearby devices\</string> \<key>nsbluetoothperipheralusagedescription\</key> \<string>uses bluetooth to connect and sync with nearby devices\</string> \<key>nslocalnetworkusagedescription\</key> \<string>uses wifi to connect and sync with nearby devices\</string> \<key>nsbonjourservices\</key> \<array> \<string> http alt tcp \</string> \</array> from xcode, ensure your app continues to sync while it runs in the background, as well as when the end user device is locked by enabling bluetooth background modes from the left navigator area, click your project click signing & capabilities click + capability and then, from the modal that appears, search and select background modes from targets , select your app from the list from background modes , click to select the following uses bluetooth le accessories acts as a bluetooth le accessory integrating and initializing sync once you've set up your environment, import the ditto sdk in your codebase and obtain your access credentials unless you have a specialized use case, such as a government app, you must connect to the internet at least once before you can sync offline with other peers for more information, see ditto basics > docid 3vo4onmgepp4s9iam0hbz from the top most scope of your app's codebase, add the following to set up authentication and start syncing offline replace your app id and your playground token with your access credentials available from the portal for instructions on how to obtain your access credentials, see docid 67na9lgptqilffugb0y29 for an introduction to authentication in ditto, see ditto basics > docid 3vo4onmgepp4s9iam0hbz let ditto = ditto(identity onlineplayground( appid "your app id", token "your playground token" )) do { try ditto startsync() } catch (let err) { print(err localizeddescription) }