Requirements
- iOS 15.0+
- Swift 5.0+
Installation
The recommended approach to using DittoSwiftTools in your project is using the Swift Package Manager.1
With your project open in Xcode go to File -> Add Packages, then search using “github.com/getditto/DittoSwiftTools” to find the DittoSwiftTools package.

2
Select “Add Package”
3
Select which DittoSwiftTools products you would like, then select “Add Package”
If you are looking for compatibility with Ditto v4, please target the v4 branch in the Swift Package Manager.
Usage
There are four targets in this package: Presence Viewer, Data Browser, Export Logs, Disk Usage.1
Presence Viewer
The Presence Viewer displays a mesh graph that allows you to see all connected peers within the mesh and the transport that each peer is using to make a connection.
First, make sure the UIKitCall

DittoPresenceViewer
was added to your Target. Then, use import DittoPresenceViewer
to import the PresenceViewer
.You can use the Presence Viewer in SiwftUI or UIKit.SwiftUIUse PresenceView(ditto: Ditto)
and pass in your Ditto instance to display the mesh graph.Swift
present
, pass the following as a parameter, and then set animated
to true
:DittoPresenceView(ditto:DittoManager.shared.ditto).viewController
Swift
2
Data Browser
The Ditto Data Browser allows you to view all your documents within each collection, including each document’s fields. With the Data Browser, you can observe any changes that are made to your collections and documents in realtime.
Standalone App If you are using the Data Browser as a standalone app, there is a button, UIKitPass

Start Subscriptions
, you must press in order to start syncing data.If you are embedding the Data Browser into another application then you do not need to press Start Subscriptions
as you should already have your subscriptions running.First, make sure the “DittoDataBrowser” was added to your Target. Then, use import DittoDataBrowser
to import the Data Browser.SwiftUIUse DataBrowser(ditto: Ditto)
and pass in your Ditto instance to display the Data Browser.Swift
DataBrowser(ditto: Ditto)
to a UIHostingController which will return a view controller that you can use to present.Swift
3
Export Logs
Export Logs allows you to export a file of the logs from your app.
First, make sure the “DittoExportLogs” was added to your Target. Then, use UIKitPass

import DittoExportLogs
to import the export logs.SwiftUIUse ExportLogs()
to export the logs. It is recommended to call ExportLogs
from within a sheet.Swift
ExportLogs()
to a UIHostingController which will return a view controller that you can use to present.Swift
4
Disk Usage
Disk Usage allows you to see Ditto’s file space usage.
First, make sure the “DittoDiskUsage” was added to your Target. Then, use 
First, make sure the “DittoDiskUsage” was added to your Target. Then, use UIKitPass

import DittoDiskUsage
to import the Disk Usage.
import DittoDiskUsage
to import the Disk Usage.SwiftUIUse DittoDiskUsageView(ditto: Ditto)
and pass in your Ditto instance.Swift
DittoDiskUsageView(ditto: Ditto)
to a UIHostingController which will return a view controller that you can use to present.Swift