SDK Setup Guides
Swift
Installing Swift SDK
you can integrate the ditto sdk into swift projects to develop native apps for apple ios and macos platforms for a complete overview of the platforms, transports, and devices the kotlin sdk supports, see docid\ gmw3z9o8mjmznvdtjwejv ditto does not offer native support for apps developed in objective c if you want to use the ditto sdk for swift with an objective c app, you must use a bridge to integrate for a code walkthrough on how to create a bridge that calls into swift from objective c, see the getditto > https //github com/getditto/example swift bridge to objectivec repository in github 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 13 0 macos version 11 0 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 the docid\ r9r027a8pwdbtdnl nfk3 > /#configuring permissions topic 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 key nsbluetoothalwaysusagedescription 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 string value http alt tcp \<key>nsbluetoothalwaysusagedescription\</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 from targets , select your app from the list from background modes , click to select uses bluetooth le accessories from the list 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\ c802c1qiakfga2qxmcywu 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\ jqjyl9gbvsgi9vlw3ywvc for an introduction to authentication in ditto, see ditto basics > docid\ c802c1qiakfga2qxmcywu let ditto = ditto(identity onlineplayground( appid "your app id", token "your playground token" )) do { try ditto startsync() } catch (let err) { print(err localizeddescription) }